Menu

pocketsphinx setting mandarin model and dictionary problem

Help
2019-02-04
2021-09-28
  • Cindy Chang

    Cindy Chang - 2019-02-04

    I copy the demoapp.py from the offical website, then I do some alteration.
    My language model is downloaded from here: https://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/Mandarin/zh_broadcastnews_64000_utf8.DMP/download
    Here is my init_gst( I only modify this function)

        def init_gst(self):
            """Initialize the speech components"""
    
            self.pipeline = gst.parse_launch('autoaudiosrc ! audioconvert !  audioresample '
                                             + '! pocketsphinx name=asr ! fakesink')
    
            bus = self.pipeline.get_bus()
            bus.add_signal_watch()
            bus.connect('message::element', self.element_message)
    
            self.pipeline.set_state(gst.State.PAUSED)
            asr = self.pipeline.get_by_name('asr');  # We previously  assigned pocketsphinx element a name asr
            asr.set_property('lm', '/Users/cindy/Documents/pythonworkspace/sphinxenv/chinese.lm')
            asr.set_property('dict', '/Users/cindy/Documents/pythonworkspace/sphinxenv/dict/chinese_dict.dict')
    

    and here is the dict file:

    前進 t ing zh ib
    後退 h ou t ui
    左轉 z uo zh uan
    右轉 y uo zh uan
    向左轉 x iang z uo zh uan
    向右轉 x iang y uo zh uan
    停止 t ing zh ib
    加速 j ia s u
    減速 j ian s u

    However, when I click the button speak and say some chinese words,
    nothing appear in the textbox.

    Please help.

     

    Last edit: Cindy Chang 2019-02-05
    • Kevin Lenzo

      Kevin Lenzo - 2021-09-28

      The models on VoxForge have 192 phonemes in them, which is more than the usual maximum of 128. To make this work with 192, you will need to edit

      pocketsphinx/src/libpocketsphinx/fsg_lextree.h

      at about line 65. Change

      #define FSG_PNODE_CTXT_BVSZ 4

      to

      #define FSG_PNODE_CTXT_BVSZ 6

      and re-compile.

       
    • Kevin Lenzo

      Kevin Lenzo - 2021-09-28
       

      Last edit: Kevin Lenzo 2021-09-28
    • Kevin Lenzo

      Kevin Lenzo - 2021-09-28
       

      Last edit: Kevin Lenzo 2021-09-28
  • Cindy Chang

    Cindy Chang - 2019-02-05

    Since there is no any error message showing, I need some code or command to help me print some debug information.

     
  • Lisa Loo

    Lisa Loo - 2020-02-22

    i have the same issue can advise?

     
    • Kevin Lenzo

      Kevin Lenzo - 2021-09-28

      Answered above

       

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.