cmusphinx / sphinx4

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

dialog.gram not found #75

Closed JulioV closed 6 years ago

JulioV commented 6 years ago

I cloned the latest version from the repo and I'm trying to run the "dialog" demo with the DemoRunner using IntelliJ 2017.2.5 and JDK 1.8 but I got the following exception:

12:21:00.802 INFO dictionary           Loading filler dictionary from: file:/C:/Users/julio/Downloads/sphinx4-5prealpha-src/sphinx4-5prealpha-src/sphinx4-data/out/production/resources/edu/cmu/sphinx/models/en-us/en-us/noisedict
Exception in thread "main" java.lang.RuntimeException: Allocation of search manager resources failed
    at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.allocate(SimpleBreadthFirstSearchManager.java:651)
    at edu.cmu.sphinx.decoder.AbstractDecoder.allocate(AbstractDecoder.java:103)
    at edu.cmu.sphinx.recognizer.Recognizer.allocate(Recognizer.java:164)
    at edu.cmu.sphinx.api.LiveSpeechRecognizer.startRecognition(LiveSpeechRecognizer.java:47)
    at edu.cmu.sphinx.demo.dialog.DialogDemo.main(DialogDemo.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at edu.cmu.sphinx.demo.DemoRunner.main(DemoRunner.java:44)
Caused by: java.io.FileNotFoundException: C:\Users\julio\Downloads\sphinx4-5prealpha-src\sphinx4-5prealpha-src\sphinx4-samples\out\production\classes\edu\cmu\sphinx\demo\dialog\dialog.gram (The system cannot find the file specified)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at java.io.FileInputStream.<init>(FileInputStream.java:93)
    at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
    at java.net.URL.openStream(URL.java:1045)
    at edu.cmu.sphinx.jsgf.parser.JSGFParser.newGrammarFromJSGF(JSGFParser.java:223)
    at edu.cmu.sphinx.jsgf.JSGFGrammar.loadNamedGrammar(JSGFGrammar.java:698)
    at edu.cmu.sphinx.jsgf.JSGFGrammar.commitChanges(JSGFGrammar.java:614)
    at edu.cmu.sphinx.jsgf.JSGFGrammar.createGrammar(JSGFGrammar.java:298)
    at edu.cmu.sphinx.linguist.language.grammar.Grammar.allocate(Grammar.java:112)
    at edu.cmu.sphinx.linguist.flat.FlatLinguist.allocate(FlatLinguist.java:264)
    at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.allocate(SimpleBreadthFirstSearchManager.java:647)
    ... 9 more

Process finished with exit code 1

I noticed that GRAMMAR_PATH is pointing to private static final String GRAMMAR_PATH = "resource:/edu/cmu/sphinx/demo/dialog/"; but when I check the resources folder there's nothing there. What am I missing?

nshmyrev commented 6 years ago

You miss this file which you need to put in corresponding folder.