Menu

JSGF Sphinx using Python

Help
Loc Le Duc
2015-11-06
2015-11-08
  • Loc Le Duc

    Loc Le Duc - 2015-11-06

    Hi

    I want it to use a simple grammar(JSGF) in Spinx using Python. So I'm flowing this example:
    https://github.com/cmusphinx/pocketsphinx/blob/master/swig/python/test/jsgf_test.py

    But I got a following output in terminal:

    INFO: ngram_search_fwdflat.c(157): fwdflat: min_ef_width = 4, max_sf_win = 25
    INFO: jsgf.c(706): Defined rule: PUBLIC <house.command>
    INFO: jsgf.c(706): Defined rule: <house.control>
    INFO: jsgf.c(706): Defined rule: <house.device>
    INFO: jsgf.c(706): Defined rule: <house.place>
    Segmentation fault (core dumped)</house.place></house.device></house.control></house.command>

    And i found the suggestion in this topic:
    https://sourceforge.net/p/cmusphinx/discussion/help/thread/d5e1a902/

    After i follow the topic, i got another error:

    ERROR: "jsgf.c", line 910: Failed to open etc/grammar.jsgf for parsing: No such file or directory
    Traceback (most recent call last):
    File "example_1.py", line 19, in <module>
    decoder = Decoder(config)
    File "/usr/local/lib/python2.7/dist-packages/pocketsphinx-0.0.8-py2.7-linux-x86_64.egg/pocketsphinx/pocketsphinx.py", line 228, in init
    this = _pocketsphinx.new_Decoder(*args)
    RuntimeError: new_Decoder returned -1</module>

    I'm sure that i have the file etc/grammar.jsgf which i create with a text document.
    I have attached all results in the terminal of 2 case in this link:
    https://www.dropbox.com/s/hgd1n07pxtlg1cy/error_jsgf?dl=0
    https://www.dropbox.com/s/logu2hchy44k95a/error_jsgf_1?dl=0

    Please help me to sort out the issue.

    Thanks and Regards,
    DucLoc.

     

    Last edit: Loc Le Duc 2015-11-06
    • Nickolay V. Shmyrev

      To get help on this issue you need to provide all the files to reproduce your problem.

       
  • Loc Le Duc

    Loc Le Duc - 2015-11-08

    Thank you Nickolay, I had found the solution for the issus.
    I follow this web (Finite State Grammars)
    http://www.speech.cs.cmu.edu/15-492/homework/hw2/
    After i convert the grammar file grammar.gram to grammar.fsg. I change the config in the code from:

       config.set_string('-lm', 'etc/dkmt_1.lm.DMP')
    

    to

       config.set_string('-fsg', 'etc/grammar.fsg')
    

    And the issus is solved.

     

    Last edit: Nickolay V. Shmyrev 2015-11-08

Log in to post a comment.