Skip to content

Commit

Permalink
Merge pull request #58 from pastore99/54-fix-lighten-loading-of-the-p…
Browse files Browse the repository at this point in the history
…atients-homepage

added javadoc for SpeechRecognition
  • Loading branch information
panuozzo77 authored Jan 10, 2024
2 parents 6837da6 + 427d67b commit faad71d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/model/service/exercise/SpeechRecognition.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
import java.util.concurrent.Future;


public class SpeechRecognition {
public class SpeechRecognition implements SpeechRecognitionInterface{
private static final String AZURE_PROPERTIES = "/azure.properties";
private static String speechKey;
private static String speechRegion;

/**
* Costruttore della classe SpeechRecognition.
* Carica le chiavi e la regione di Azure Speech-to-Text dal file di configurazione.
*/
public SpeechRecognition(){
Properties azureProps = loadProps();
speechRegion = azureProps.getProperty("azure.region");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package model.service.exercise;

import java.io.*;
import java.util.concurrent.ExecutionException;


public interface SpeechRecognitionInterface {

/**
* Effettua il riconoscimento vocale utilizzando i servizi di Azure Speech-to-Text.
*
* @param audio InputStream rappresentante l'audio da analizzare.
* @return Una stringa contenente il testo riconosciuto, o null se non riconosciuto.
* @throws InterruptedException se il thread viene interrotto durante l'esecuzione.
* @throws ExecutionException se si verifica un errore durante l'esecuzione del task.
* @throws IOException se si verifica un errore di input/output.
*/
public String azureSTT(InputStream audio) throws InterruptedException, ExecutionException, IOException;

/**
* Genera un file temporaneo a partire da un InputStream.
*
* @param inputAudio InputStream dell'audio.
* @return Il percorso del file temporaneo creato.
* @throws IOException se si verifica un errore di input/output.
*/
public String generateFile(InputStream inputAudio) throws IOException;
}

0 comments on commit faad71d

Please sign in to comment.