The CMU Sphinx Group Open Source Speech Recognition Engines

Speech at CMU   |   Sphinx at SourceForge

Introduction

General Documentation

CMUSphinx Components

Common library

Decoders

Acoustic Model Training

Language Model Training

Utilities


Latest News

SphinxTrain 1.0 Released
2009-02-12 16:05
Read More »

Sphinx-4 1.0 beta2 released
2009-02-07 18:27
Read More »

Sphinx3 0.8 released
2009-01-01 04:38
Read More »

Site news archive »


External Links

Notice: if you have comments about the links below, please contact the authors directly.

CMU Sphinx documentation Wiki

Building a language model

This page describes how to create a simple LanguageModel for PocketSphinx or SphinxThree from a list of words and phrases. Language models built in this way are quite functional for simple command and control tasks.

Creating a sentence corpus

The "corpus" is just a list of sentences that you will use to train the language model. As an example, we will use a hypothetical voice control task for a mobile Internet device. We'd like to tell it things like "open browser", "new e-mail", "forward", "backward", "next window", "last window", "open music player", and so forth. So, we'll start by creating a file called corpus.txt:

open browser
new e-mail
forward
backward
next window
last window
open music player

Running the LMTool

The simplest way to build a language model is to use the on-line web tool at http://www.speech.cs.cmu.edu/tools/lmtool.html. Simply click on the "Browse..." button, select the corpus.txt file you created, then click "COMPILE KNOWLEDGE BASE".

You should see a page with some status messages, followed by a page entitled "Sphinx knowledge base". This page will contain links entitled "Dictionary" and "Language Model". Download these files and make a note of their names (they should consist of a 4-digit number followed by the extensions .dic and .lm). You can now test your newly created language model with PocketSphinx.

Using your language model

This section will show you how to use, test, and improve the language model you created.

Using your language model with PocketSphinx

If you have installed PocketSphinx, you will have a program called pocketsphinx_continuous which can be run from the command-line to recognize speech. You will also have some standard acoustic models to use. The wsj1 model is the one that is best suited for general English speech recognition. In order to run pocketsphinx-continuous you will need to know where this language model is installed. By default, it will be in /usr/local/share/pocketsphinx/model/hmm/wsj1. If you installed PocketSphinx from a Debian or Ubuntu package it will be in /usr/share/pocketsphinx/model/hmm/wsj1 instead. This directory name is what you will pass to pocketsphinx_continuous on the command-line, along with the langauge model and dictionary you just created.

Assuming it is installed under /usr/local, and your language model and dictionary are called 8521.dic and 8521.lm, try running the following command:

pocketsphinx_continuous -hmm /usr/local/share/pocketsphinx/model/hmm/wsj1 -lm 8521.lm -dict 8521.dic

You will see a lot of diagnostic messages, followed by a pause, then "READY...". Now you can try speaking some of the commands. It should be able to recognize them with complete accuracy. If not, you may have problems with your microphone or sound card.

LanguageModelHowto (last edited 2008-02-21 03:34:55 by localhost)

SourceForge.net Logo This page is maintained by David Huggins-Daines ()
CMUSphinx is a project within the Sphinx Group at Carnegie Mellon