Vote count:
0
i was running the default helloworld.java( that comes in the sphinx src folder) the code run properly, but when i speak something like 'hello will' the code returns 'good morning rita'. i mean the code is not listening what i am saying and returns anything . please help this out..
package edu.cmu.sphinx.demo.helloworld;
import edu.cmu.sphinx.frontend.util.Microphone;
import edu.cmu.sphinx.recognizer.Recognizer;
import edu.cmu.sphinx.result.Result;
import edu.cmu.sphinx.util.props.ConfigurationManager;
/**
* A simple HelloWorld demo showing a simple speech application built using Sphinx-4. This application uses the Sphinx-4
* endpointer, which automatically segments incoming audio into utterances and silences.
*/
public class HelloWorld {
public static void main(String[] args) {
ConfigurationManager cm;
if (args.length > 0) {
cm = new ConfigurationManager(args[0]);
} else {
cm = new ConfigurationManager(HelloWorld.class.getResource("helloworld.config.xml"));
}
Recognizer recognizer = (Recognizer) cm.lookup("recognizer");
recognizer.allocate();
// start the microphone or exit if the programm if this is not possible
Microphone microphone = (Microphone) cm.lookup("microphone");
if (!microphone.startRecording()) {
System.out.println("Cannot start microphone.");
recognizer.deallocate();
System.exit(1);
}
System.out.println("Say: (Good morning | Hello) ( Bhiksha | Evandro | Paul | Philip | Rita | Will )");
// loop the recognition until the programm exits.
while (true) {
System.out.println("Start speaking. Press Ctrl-C to quit.\n");
Result result = recognizer.recognize();
if (result != null) {
String resultText = result.getBestFinalResultNoFiller();
System.out.println("You said: " + resultText + '\n');
} else {
System.out.println("I can't hear what you said.\n");
}
}
}
}
asked 1 min ago
Sphinx6 Helloworld java program not listening properly
Aucun commentaire:
Enregistrer un commentaire