PocketSphinx.pm |
NONE
Use this module to control the PocketSphinx VR engine (currently Linux only)
Requirements:
Download and install Sphinxbase, PocketSphinx, and CMU Language Toolkit http://cmusphinx.sourceforge.net/wiki/download/
Current Version Supported:
PocketSphinx: 0.7
SphinxBase: 0.7
Cmuclmtk: 0.7
When building SphinxBase, it will default to OSS, if you want ALSA (recommended) then you need to add --with-alsa to the configure command.
Install and configure all the above software. Set these values in your mh.private.ini file Note that all those marked as default are in mh.ini and need not be loaded unless truly different. Enable the pocket_sphinx_control module in misterhouse setup (code/common).
Generic_Item
_trim
Trim leading and trailing spaces
restart
Shut down the process before we restart
said
Check for any new voice command from external pocketsphinx client(s)
build_sentence_file
BUILD SENTENCE FILE
build_lm
BUILD LANGUAGE MODEL FILE
1) Prepare a reference text that will be used to generate the language model. The language model toolkit expects its input to be in the form of normalized text files, with utterances delimited by <s> and </s> tags. A number of input filters are available for specific corpora such as Switchboard, ISL and NIST meetings, and HUB5 transcripts. The result should be the set of sentences that are bounded by the start and end sentence markers: <s> and </s>.
Here's an example:
<s> generally cloudy today with scattered outbreaks of rain and drizzle persistent and heavy at times </s>
<s> some dry intervals also with hazy sunshine especially in eastern parts in the morning </s>
<s> highest temperatures nine to thirteen Celsius in a light or moderate mainly east south east breeze </s>
<s> cloudy damp and misty today with spells of rain and drizzle in most places much of this rain will be
light and patchy but heavier rain may develop in the west later </s>
2) Generate the vocabulary file. This is a list of all the words in the file:
text2wfreq < weather.txt | wfreq2vocab > weather.tmp.vocab
3) You may want to edit the vocabulary file to remove words (numbers, misspellings, names). If you find misspellings, it is a good idea to fix them in the input transcript.
4) If you want a closed vocabulary language model (a language model that has no provisions for unknown words), then you should remove sentences from your input transcript that contain words that are not in your vocabulary file.
5) Generate the arpa format language model with the commands:
% text2idngram -vocab weather.vocab -idngram weather.idngram < weather.closed.txt
% idngram2lm -vocab_type 0 -idngram weather.idngram -vocab \
weather.vocab -arpa weather.arpa
6) Generate the CMU binary form (DMP)
% sphinx_lm_convert -i weather.arpa -o weather.lm
/usr/local/bin/text2wfreq < current.sent | /usr/local/bin/wfreq2vocab > current.vocab
text2idngram -vocab current.vocab -idngram current.idngram < current.sent
/usr/local/bin/idngram2lm -vocab_type 0 -idngram current.idngram -vocab current.vocab -arpa current.arpa
/usr/local/bin/sphinx_lm_convert -i current.arpa -o current.lm
voice_cmd = pocketsphinx # REQUIRED
server_pocketsphinx_port = 3235 # REQUIRED
pocketsphinx_awake_phrase = "mister house,computer" # optional
pocketsphinx_awake_response = "yes master?" # optional
pocketsphinx_awake_time=300 # optional
pocketsphinx_asleep_phrase={go to sleep,change to sleep mode} # optional
pocketsphinx_asleep_response=Ok, later.
pocketsphinx_timeout_response=Later.
pocketsphinx_hmm = /usr/local/share/pocketsphinx/model/hmm/en_US/hub4wsj_sc_8k # default
pocketsphinx_rate = 16000 # default
pocketsphinx_continuous = /usr/local/bin/pocketsphinx_continuous # default
pocketsphinx_dev = default # default
Note: If using OSS instead of ALSA, pocketsphinx_device needs to be "/dev/dsp" or similiar.
- pocketsphinx_awake_phrase: Command(s) that will switch mh into active
mode (all commands recognized) from asleep mode.
- pocketsphinx_awake_response: This is what is said (or played) when entering
awake mode
- pocketsphinx_awake_time: Stay in awake mode for this many seconds after
the last command was heard. Then it switches
to asleep mode. Set to 0 or blank to disable
(always stay in awake mode).
- pocketsphinx_asleep_phrase: Command{s} to put mh into asleep mode.
- pocketsphinx_asleep_response: This is what it said (or played) when entering
sleep mode
- pocketsphinx_timeout_response: This is what is said (or played) when the awake
timer expires.
- pocketsphinx_hmm Pocketsphinx Human Markov Model directory location.
- pocketsphinx_rate Audio Sample rate
- pocketsphinx_continuous Program location for pocketsphinx_continuous
- pocketsphinx_dev Audio device (multiple devices can be separated by "|")
01/21/2007 Created by Jim Duda (jim@duda.tzo.com)
NONE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
NONE
NONE
Generic_Item
new
Constructor
set_hmm_file
Set functions
_trim
Trim leading and trailing spaces
restore_string
We need to save the persistent information for the Process_Item p_sphinx object between restart and startup such that we can safely kill any running pocketsphinx processes. We'll save the persistent information in restore_data and eval to play it out and restore the object information.
restore
Restore will be called on startup or restart such that we can play out the information contained in p_shpinx_state, which represents the persistent data for the Process_Item object.
restart
Shut down the process before we restart
speak
Update speak parameters based upon context
set_speak_room
Define the speaking room
start_listner
Allow the listener to startup on the next pass of the state_machine maintenance thread.
stop_listner
Stop any active listener program currently running
state_machine
The state_machine loop runs once each pass of misterhouse. This is basically a maitanance thread which insures that the listener is running, since it has been known to crash on its own. We keep a count of restarts to avoid thrashing since the crashes could be caused by bad configuration.
NONE
01/21/2007 Created by Jim Duda (jim@duda.tzo.com)
NONE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
PocketSphinx.pm |