Menu

grammer config

Help
2016-11-03
2016-11-05
  • rastinrastini

    rastinrastini - 2016-11-03

    Hi

    i have below config in code but it return words that is not in this grammer. why?

    configuration
    .setAcousticModelPath("file:" + ws);
    configuration
    .setDictionaryPath("file:" + ws1);
    configuration
    .setLanguageModelPath("file:" + ws2);
    configuration.setGrammarPath("file:F:\projects\speech\test_speech\test_speech\src\main\java\com\mycompany\test_speech\hello.gram");

     
    • Nickolay V. Shmyrev

      You need configuration.setUseGrammar(true), and there is no need to call setLanguageModelPath if you want to use grammar.

       
      • rastinrastini

        rastinrastini - 2016-11-03

        thx for help.

        then why this exception is throws?

        edu.cmu.sphinx.jsgf.parser.TokenMgrError: Lexical error at line 8, column 20. Encountered: "\u00ac" (172), after : ""
        at edu.cmu.sphinx.jsgf.parser.JSGFParserTokenManager.getNextToken(JSGFParserTokenManager.java:1187)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.jj_ntk(JSGFParser.java:998)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.item(JSGFParser.java:636)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.sequence(JSGFParser.java:559)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.alternatives(JSGFParser.java:473)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.item(JSGFParser.java:669)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.sequence(JSGFParser.java:559)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.alternatives(JSGFParser.java:473)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.RuleDeclaration(JSGFParser.java:438)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.GrammarUnit(JSGFParser.java:299)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.newGrammarFromJSGF(JSGFParser.java:122)
        at edu.cmu.sphinx.jsgf.parser.JSGFParser.newGrammarFromJSGF(JSGFParser.java:232)
        at edu.cmu.sphinx.jsgf.JSGFGrammar.loadNamedGrammar(JSGFGrammar.java:703)
        at edu.cmu.sphinx.jsgf.JSGFGrammar.commitChanges(JSGFGrammar.java:619)
        at edu.cmu.sphinx.jsgf.JSGFGrammar.createGrammar(JSGFGrammar.java:303)
        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)
        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 com.mycompany.test_speech.Main.microphoneRec(Main.java:62)
        at com.mycompany.test_speech.Main.main(Main.java:55)

         
        • Nickolay V. Shmyrev

          Something wrong with your grammar. You can share it to get futher help.

           
          • rastinrastini

            rastinrastini - 2016-11-04

            grammer file attached.

             
            • Nickolay V. Shmyrev

              Try to add -Dfile.encoding=utf-8 to jvm options.

               
              • rastinrastini

                rastinrastini - 2016-11-05

                very thx. solved.

                 

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.