cmusphinx / sphinx4

Pure Java speech recognition library
cmusphinx.sourceforge.net
Other
1.4k stars 586 forks source link

Typo in Tutorial Page #65

Closed ginward closed 7 years ago

ginward commented 7 years ago

Hello,

In the Tutorial Page, there is a typo in the code:

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.

Anyone can fix this on the website?

jinhua

nshmyrev commented 7 years ago

Fixed, thank you for the report!