Menu

Problem running SPHINX4 demos built from Svn

Help
roachcoach
2008-12-03
2012-09-22
  • roachcoach

    roachcoach - 2008-12-03

    I was trying to run all the demo programs for SPHINX4. I had no problems running the HelloWorld, HelloDigits, HelloN-Gram, ZipCity, WavFile, Transcriber, and Confidence demos.

    But I was unable to run the JSGFDemo and Dialog demo jar files. When running JSGFDemo I get:
    C:\sphinx4>java -mx312m -jar bin\JSGFDemo.jar
    JSGF Demo Version 1.0

    Loading recognizer ...I/O Error java.io.FileNotFoundException: JAR entry demo/jsapi/jsgf/commands.gram not found in C:\sphinx4\bin\JSGFDemo.jar

    I am new to packages, JAR files, and SPHINX, but I had the following analysis:

    Even though the demos are in edu/cmu/sphinx/demo/jsapi/jsgf/ package, the location is still /demo/jsapi/jsgf/ in line 102 of jsgf.config.xml :
    <property name="grammarLocation"
    value="resource:/edu.cmu.sphinx.demo.jsapi.jsgf.JSGFDemo!/demo/jsapi/jsgf/"/>

    Changing it to:
    value="resource:/edu.cmu.sphinx.demo.jsapi.jsgf.JSGFDemo!/edu/cmu/sphinx/demo/jsapi/jsgf/"/>

    and rebuilding the demos lets the program proceed, but to fail again:
    JSGF Demo Version 1.0

    Loading recognizer ...
    Ready
    Exception in thread "main" java.lang.IllegalArgumentException: Unknown Rule: standard_commands
    at com.sun.speech.engine.recognition.BaseRuleGrammar.isEnabled(BaseRuleG
    rammar.java:222)
    at edu.cmu.sphinx.jsapi.JSGFGrammar.isRuleDisabled(JSGFGrammar.java:441)

        at edu.cmu.sphinx.jsapi.JSGFGrammar.parseRuleSequence(JSGFGrammar.java:4
    

    92)
    at edu.cmu.sphinx.jsapi.JSGFGrammar.parseRule(JSGFGrammar.java:278)
    at edu.cmu.sphinx.jsapi.JSGFGrammar.parseRuleAlternatives(JSGFGrammar.ja
    va:427)
    at edu.cmu.sphinx.jsapi.JSGFGrammar.parseRule(JSGFGrammar.java:272)
    at edu.cmu.sphinx.jsapi.JSGFGrammar.commitChanges(JSGFGrammar.java:595)
    at edu.cmu.sphinx.jsapi.JSGFGrammar.loadJSGF(JSGFGrammar.java:233)
    at edu.cmu.sphinx.demo.jsapi.jsgf.JSGFDemo.loadAndRecognize(JSGFDemo.jav
    a:112)
    at edu.cmu.sphinx.demo.jsapi.jsgf.JSGFDemo.execute(JSGFDemo.java:85)
    at edu.cmu.sphinx.demo.jsapi.jsgf.JSGFDemo.main(JSGFDemo.java:224)

    This time I think the problem is in the grammar file. When I substitute the following line in movies, music, news & books.gram files :
    public <commands> = <standard_commands> ;

    with:
    public <commands> = go to the next menu { exit } ;

    (copied from the imported commands.gram), it starts running(I could not check if it was recognizing).

    But since the grammar files are exactly the same as in the release version, obviously something else is wrong. Again, I am new to JSGF, the original files seem correct, and my changes are bad hacks.

    There are similar Jar file package path issue with the Dialog demo. But it does not have any problems with the grammar files, because it does not have any imports I guess.

    I would appreciate it if somebody could point me out what is wrong with the grammar files/packages/the Jar file paths.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.