pocketsphinx dic files and scripts

A home for all kinds of Puppy related projects
Post Reply
Message
Author
User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

pocketsphinx dic files and scripts

#1 Post by greengeek »

Technosaurus made available a pet for pocketsphinx which allows puppy to recognise the human voice. If you set up special dictionary files it allows you to make pocketsphinx respond with excellent accuracy to whatever selected group of commands you choose..

This thread is intended as a collection point for special purpose dic files tailored for specific uses (and development testing...). Wherever possible those dic files should be accompanied by a script that is designed to act upon the commands that pocketsphinx decodes.

Very keen for anyone to post whatever dic files they find relevant!

NOTES :
1) pocketsphinx needs to be installed before these files or scripts will be of any use to you.
technosaurus original .pet link here:
http://www.murga-linux.com/puppy/viewto ... 5&start=27

2) My notes re how to make a new dic file here:
http://murga-linux.com/puppy/viewtopic. ... 733#730733

3) dic files contain a CAPITALISED version of the commands that you initially submit for compilation. This is how pocketsphinx identifies your special vocabulary as being different to its original vocab set. Your script therefore needs to identify CAPITALISED commands eg: when you say "start browser" the pocketsphinx output becomes START-BROWSER not start-browser.

To see the list of decoded output commands associated with each dic file simply open the xxxx.vocab file as text. (These output commands are what your script must recognise)


If you already have pocketsphinx set up correctly all you need to do to get a special set of dic files running is to copy the five files into the /usr/share/pocketsphinx/model/lm directory (no need to remove any previous dic files).

Whatever script you use to start pocketsphinx needs to reference the new dic files as follows:

Code: Select all

#pocketsphinx_continuous -lm nameofnewfile.lm -dict nameofnewfile.dic

If you don't have pocketsphinx already installed here are my my notes for getting pocketsphinx installed and set up with a special set of dic files:

1) Download technosaurus pocketsphinx pet from here:
http://murga-linux.com/puppy/viewtopic. ... 5&start=27
2) Install the pet
3) Create a new directory of /usr/share/pocketsphinx (we will be using this later...)
4) Download the other source files referred to by technosaurus from this link:
http://hivelocity.dl.sourceforge.net/pr ... 0.8.tar.gz
5) Extract these files in your download directory and copy the "model" directory from the source into the /usr/share/pocketsphinx directory created above. (ie it becomes /usr/share/pocketsphinx/model)
6) Choose the set of special dic files that you want and copy them into the /usr/share/pocketsphinx/model/lm directory as loose files. There is no need to remove any previous dic files.
7) Use your script to start pocketsphinx as shown above - referencing the correct name of the dic files you have added.

Testing without a start/recognition/action script :
If you do not yet have a script and just want to manually confirm that pocketsphinx is correctly decoding your speech do the following:

Go into /usr/bin, right click the openspace and choose "window, terminal here"
Ensure that your microphone is plugged in then type the following:

Code: Select all

#./pocketsphinx_continuous -lm nameofnewfile.lm -dict nameofnewfile.dic
(note the dot and slash at the beginning)

You should see pocketsphinx set itself up and then show
READY....

Speak each of the commands included in the special dic file (do it slowly so the program has 3 seconds or so to recognise each word) and you should see the spoken command recognised. Check the whole list to ensure the integrity of recognition matches what you need. If it's working go ahead and write a script to handle the capitalised commands output from sphinx.
.
Last edited by greengeek on Sat 26 Oct 2013, 20:31, edited 6 times in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#2 Post by greengeek »

reserved

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#3 Post by greengeek »

reserved

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#4 Post by greengeek »

reserved

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#5 Post by greengeek »

starter002
This dic file and associated script is intended to be used as a test bed for development of scripts allowing the user to control their PC verbally after booting. Commands included in starter002 are:

Code: Select all

start-browser
start-word-processor
start-music-random
start-paint
start-gimp
start-genie
start-H-top
start-file-manager
menu-file
menu-edit
menu-step-across
menu-step-down
menu-step-up
speak-menu
window-alt-tab
speak-window-title
maximise-window
minimise-window
close-window
select-all
copy-to-clipboard
paste-from-clipboard
take-screenshot
volume-up
volume-down
shutdown
reboot
The script does not yet attach the full functionality to every command (it is a work in progress awaiting some user feedback :-) ) - some of the commands merely echo the spoken command back through the speakers (I recommend wearing headphones so there is no conflict with feedback to confuse pocketsphinx). ***This speech only works if you have espeak already installed***

***pocketsphinx must have already been installed as detailed elsewhere*****

Install the extracted dic files into /usr/share/pocketsphinx/model/lm as loose files, then put the starter002 script somewhere like /root (make sure it is executable) and click it (make sure you have no other instances of pocketsphinx running first)

Talk away! Once you have confirmed reliability of command recognition you can modify the script to suit the specifics of what you want to do with each command.
Attachments
vox_starter002.falsegz.gz
Remove false gz suffixes from this file only
(1.77 KiB) Downloaded 362 times
starter002_dic files.tar.gz
This is a genuine tar gz.
Extract these files into /usr/share/pocketsphinx/model/lm as loose files
(2.07 KiB) Downloaded 364 times
Last edited by greengeek on Sat 26 Oct 2013, 18:36, edited 2 times in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#6 Post by greengeek »

voxclick003

This script and dic files are specific to mouseclick functionality. Command set as follows:

Code: Select all

click
rightclick
centerclick
doubleclick
clickhold
release
thread here if problems:
http://murga-linux.com/puppy/viewtopic.php?t=89370
Attachments
voxclick003.falsegz.gz
This is the script to process the mouseclick commands.
Please remove the false gz suffixes.
(587 Bytes) Downloaded 343 times
voxclick003_dic_files.tar.gz
This is a genuine tar gz
Extract these into the /usr/share/pocketsphinx/model/lm
directory as loose files
(1000 Bytes) Downloaded 369 times

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

voxstarter004

#7 Post by greengeek »

voxstarter004

This is more or less a combination of the two dic files above. It has a couple of changes to aid clarity and also activates the volume up / volume down functions.

command set as follows:

Code: Select all

start-browser
start-word-processor
start-music-random
start-paint
start-gimp
start-genie
start-H-top
start-file-manager
menu-file
menu-edit
menu-step-across
menu-step-down
menu-step-up
speak-menu
window-alt-tab
speak-window-title
maximise-window
minimise-window
close-window
select-all
copy-to-clipboard
paste-from-clipboard
take-screenshot
volume-up
volume-down
click
rightclick
centerclick
doubleclick
clickhold
release
shutdown-computer
reboot-computer
restart-x-server
Attachments
voxstarter004.falsegz.gz
Remove false gz suffixes
(2.17 KiB) Downloaded 346 times
voxstarter004_dic_files.tar.gz
This is a genuine tar gz.
Extract these files into /usr/share/pocketsphinx/model/lm
(2.4 KiB) Downloaded 335 times

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#8 Post by greengeek »

voxmain001

voxmain001 has a larger command set than my previous scripts and is a demonstration of the ability to switch from one set of dictionary files to another - a feature that might be useful for various purposes.

voxmain001 consists of several scripts which should be placed in /root. (and add the dic files to /usr/share/pocketsphinx/model/lm as in previous examples)

Click on the /root/voxmain001_starter script and it will initially start pocketsphinx in what I call "complex" mode - this means that each command has to be prefixed with the words "voice-control-"

eg:
"voice-control-volume-mute"
"voice-control-start-geany"

(This mode is designed to ensure that background conversation in the room does not trigger voice commands).

When the room does not have any troublesome background noise, or when you get tired of the long-winded phrases in complex mode just issue the following command:

"voice-control-activate-simple"

and pocketsphinx will be restarted with a different set of dic files - the "voxmainsimple" dic files which do not require the "voice-control-" prefix. So now you would say:

"volume-mute"
"start-geany" etc

The voxmainsimple command set is as follows:

Code: Select all

start-browser
start-word-processor
start-music-random
start-paint
start-gimp
start-genie
start-H-top
start-file-manager
menu-file
menu-edit
menu-file-open
menu-file-new
menu-file-save
menu-file-quit
menu-file-print
menu-step-across
menu-step-down
menu-step-up
speak-menu
window-alt-tab
speak-window-title
maximise-window
minimise-window
close-window
select-all
copy-to-clipboard
paste-from-clipboard
take-screenshot
volume-max
volume-three-quarters
volume-half
volume-one-quarter
volume-low
volume-mute
click
rightclick
centerclick
doubleclick
clickhold
release
shutdown-computer
reboot-computer
restart-x-server
voice-control-activate-complex
voice-control-activate-simple
voice-control-branch
voice-control-return-to-main

Most of these commands are now functional (but not all...)

You can switch between simple and complex modes at will by using each of these two commands:

Code: Select all

voice-control-activate-complex
voice-control-activate-simple
(both commands are available in both modes)

complex mode command set is as follows:

Code: Select all

voice-control-start-browser
voice-control-start-word-processor
voice-control-start-music-random
voice-control-start-paint
voice-control-start-gimp
voice-control-start-genie
voice-control-start-H-top
voice-control-start-file-manager
voice-control-menu-file
voice-control-menu-edit
voice-control-menu-file-open
voice-control-menu-file-new
voice-control-menu-file-save
voice-control-menu-file-quit
voice-control-menu-file-print
voice-control-menu-step-across
voice-control-menu-step-down
voice-control-menu-step-up
voice-control-speak-menu
voice-control-window-alt-tab
voice-control-speak-window-title
voice-control-maximise-window
voice-control-minimise-window
voice-control-close-window
voice-control-select-all
voice-control-copy-to-clipboard
voice-control-paste-from-clipboard
voice-control-take-screenshot
voice-control-volume-max
voice-control-volume-three-quarters
voice-control-volume-half
voice-control-volume-one-quarter
voice-control-volume-low
voice-control-volume-mute
voice-control-click
voice-control-rightclick
voice-control-centerclick
voice-control-doubleclick
voice-control-clickhold
voice-control-release
voice-control-shutdown-computer
voice-control-reboot-computer
voice-control-restart-x-server
voice-control-activate-complex
voice-control-activate-simple
voice-control-branch
voice-control-return-to-main

For those that don't already have the pre-requisites installed:
I have made a full .pet of voxmain001 which also includes xdotool,, espeak and a couple of libs that espeak requires on some systems. This allows voxmain001 to be trialled on a liveCD session without savefile or extra files having to be found. Just install the .pet and then RESTART X SERVER - the voxmaincomplex menu will auto start in the .pet version.
http://www.mediafire.com/download/gx993 ... ain001.pet

NOTE : the .pet is not required if you have already been trialling previous dic files - you can just add the scripts and files that are attached below:.
.
Attachments
voxmain001_scripts.tar.gz
Extract all these scripts into /root
(1.89 KiB) Downloaded 331 times
voxmain001_dicfiles.tar.gz
Extract these into /usr/shar/pocketsphinx/model/lm
(4.44 KiB) Downloaded 356 times

Post Reply