public static void main(String[] args) throws Exception {
Configuration configuration = new Configuration();
configuration
.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
configuration
.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
configuration
.setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.bin");
StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(
configuration);
InputStream stream = new FileInputStream(new File("test.wav")))
recognizer.startRecognition(stream);
SpeechResult result;
while ((result = recognizer.getResult()) != null) {
System.out.format("Hypothesis: %s\n", result.getHypothesis());
}
recognizer.stopRecognition();
}
In the code above, InputStream stream = new FileInputStream(new File("test.wav"))) should be InputStream stream = new FileInputStream(new File("test.wav")); instead.
Hello,
In the Tutorial Page, there is a typo in the code:
In the code above, InputStream stream = new FileInputStream(new File("test.wav"))) should be InputStream stream = new FileInputStream(new File("test.wav")); instead.
Anyone can fix this on the website?
jinhua