madper
madper

Reputation: 796

How to choose pocketSphinx's language model in python

I just need a speech recognition library in linux. Then I choose CMU Sphinx, and use pocketSphinx with python. I test that demo. This example runs well in my computer with poor accuracy.


I know that I need a language model, and I have downloaded it. So, How to set my pocketSphinx use that 'lm'. I mean, How to fix that demo file to use that language model. (and acoustic model.)

Thank you very much!

Upvotes: 2

Views: 1990

Answers (1)

Nikolay Shmyrev
Nikolay Shmyrev

Reputation: 25210

Language model is configured through the property of the pocketsphinx gstreamer component. Instead of

   gst.parse_launch('gconfaudiosrc ! audioconvert ! audioresample '
                    + '! vader name=vad auto-threshold=true '
                    + '! pocketsphinx name=asr ! fakesink')

Use

   gst.parse_launch('gconfaudiosrc ! audioconvert ! audioresample '
                    + '! vader name=vad auto-threshold=true '
                    + '! pocketsphinx lm=<your_file.lm> name=asr ! fakesink')

You can configure other properties of pocketsphinx component too. Use gst-inspect to read the list.

Upvotes: 2

Related Questions