public static void main(String[] args) { try {
URL url;
if (args.length > 0) {
url = new File(args[0]).toURI().toURL();
} else {
url = HelloWorld.class.getResource("helloworld.config.xml");
}
System.out.println("Loading...");
ConfigurationManager cm = new ConfigurationManager(url);
System.out.println("Configured Successfully");
Recognizer recognizer = (Recognizer) cm.lookup("recognizer"); // I found exception in this line
System.out.println("Recognizer Ready");
Microphone microphone = (Microphone) cm.lookup("microphone");
System.out.println("Microphone Ready");
/* allocate the resource necessary for the recognizer */
recognizer.allocate();
/* the microphone will keep recording until the program exits */
if (microphone.startRecording()) {
System.out.println("Say: (Good morning | Hello) " +
"( Bhiksha | Evandro | Paul | Philip | Rita | Will )");
while (true) {
System.out.println ("Start speaking. Press Ctrl-C to quit.\n");
/*
* This method will return when the end of speech
* is reached. Note that the endpointer will determine
* the end of speech.
*/
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");
} }
} else { System.out.println("Cannot start microphone."); recognizer.deallocate(); System.exit(1);
}
} catch (IOException e) {
System.err.println("Problem when loading HelloWorld: " + e);
e.printStackTrace();
} catch (PropertyException e) {
System.err.println("Problem configuring HelloWorld: " + e);
e.printStackTrace();
} catch (Exception e) {
System.err.println("Problem creating HelloWorld: " + e);
e.printStackTrace();
} }
このコードでは、次の例外が発生しました。
class not found !java.lang.ClassNotFoundException:
edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model
Problem configuring HelloWorld: Property Exception component:'flatLinguist'
property:'acousticModel' - mandatory property is not set!
edu.cmu.sphinx.util.props.InternalConfigurationException
Property Exception component:'flatLinguist' property:'acousticModel' - mandatory
property is not set!
edu.cmu.sphinx.util.props.InternalConfigurationException
このエラーは、プログラムを実行すると発生します。
どうすればこれを解決できますか?