Speech Recognition using PocketSphinx on Win32

Jul 11, 03:00 PM

The zeroth thing you need is the Pocketsphinx binaries.

Just download the win32 binaries from the Sphinx website (download pocketsphinx, sphinxbase, sphinxtrain and cmuclmtk from the Sphinx website).

The first thing you need to do is build a language model or a grammar.

The grammar can be something simple in a format called JSGF, and this is the easier way to get a speech recognizer up and running. Alternatively, you can use a language model. The language model can be built using the instructions on the Sphinx site. You can create it starting from a file with sentences like this:

<s> I WANT A NEXTCUBE ZERO FOUR ZERO </s>
<s> I WANT THE NEXTCUBE ZERO FOUR ZERO </s>
<s> I NEED A NEXTCUBE ZERO FOUR ZERO </s>
<s> I NEED THE NEXTCUBE ZERO FOUR ZERO </s>
<s> I AM LOOKING FOR A NEXTCUBE ZERO FOUR ZERO </s>
<s> I AM LOOKING FOR THE NEXTCUBE ZERO FOUR ZERO </s>
<s> I AM SEEKING A NEXTCUBE ZERO FOUR ZERO </s>
<s> I AM SEEKING THE NEXTCUBE ZERO FOUR ZERO </s>

A sample JSGF file would be (modified from the sample on the Sphinx website) … note that I’ve made all the words capitals because the CMU phonetic dictionary has all the words listed in caps (make sure that any language model is all caps as well, except for the sentence boundaries):

#JSGF V1.0;
/**
 * JSGF Grammar for Hello World example
 */
grammar hello;
public <greet> = (GOOD MORNING | HELLO | HI) ( PAUL | RITA | WILL );

The second thing you need is an Acoustic Model

An acoustic model maps sound features from the speech recognizer to phonemes.
Voxforge provides a free acoustic model for Pocketsphinx that you can use.

The third thing you need is a phonetic dictionary

The phonetic dictionary maps the recognized phonemes to actual words in your language. For English, there is a phonetic dictionary available from CMU

You will just need to download one file: cmudict.0.7a_SPHINX_40

Now, you have all the components you need!

Running Pocketsphinx

With JSGF:

$ pocketsphinx-0.7-win32/pocketsphinx_continuous.exe \
-hmm voxforge-en-r0_1_3/model_parameters/voxforge_en_sphinx.cd_cont_3000 \
-jsgf greet.jsgf \
-dict cmudict.0.7a_SPHINX_40

With a language model:

$ pocketsphinx-0.7-win32/pocketsphinx_continuous.exe \
-hmm voxforge-en-r0_1_3/model_parameters/voxforge_en_sphinx.cd_cont_3000 \ -lm cmuclmtk-0.7-win32/output.lm.DMP \
-dict cmudict.0.7a_SPHINX_40l

Any additional phonetic entries in the phonetic dictionary can be created using the CMU dictionary phoneme set

Education

  1. Videos on speech recognition
  2. Lectures on speech recognition
  3. Voxforge has an article on what an acoustic model is
Cohan Sujay Carlos

User Guides,

---

Comment

Commenting is closed for this article.

---