Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added javadoc for SpeechRecognition #58

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Loading