Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 30 Aug 2014, 02:52
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects
pocketsphinx dic files and scripts
Moderators: Flash, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [8 Posts]  
Author Message
greengeek

Joined: 20 Jul 2010
Posts: 2502
Location: New Zealand

PostPosted: Fri 25 Oct 2013, 19:53    Post subject:  pocketsphinx dic files and scripts  

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/viewtopic.php?t=88095&start=27

2) My notes re how to make a new dic file here:
http://murga-linux.com/puppy/viewtopic.php?&p=730733#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:
#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.php?t=88095&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/project/cmusphinx/pocketsphinx/0.8/pocketsphinx-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:
#./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, 16:31; edited 6 times in total
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2502
Location: New Zealand

PostPosted: Fri 25 Oct 2013, 19:53    Post subject:  

reserved
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2502
Location: New Zealand

PostPosted: Fri 25 Oct 2013, 19:53    Post subject:  

reserved
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2502
Location: New Zealand

PostPosted: Fri 25 Oct 2013, 19:54    Post subject:  

reserved
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2502
Location: New Zealand

PostPosted: Fri 25 Oct 2013, 20:10    Post subject:  

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:
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 Smile ) - 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.
vox_starter002.falsegz.gz
Description  Remove false gz suffixes from this file only
gz

 Download 
Filename  vox_starter002.falsegz.gz 
Filesize  1.77 KB 
Downloaded  106 Time(s) 
starter002_dic files.tar.gz
Description  This is a genuine tar gz.
Extract these files into /usr/share/pocketsphinx/model/lm as loose files
gz

 Download 
Filename  starter002_dic files.tar.gz 
Filesize  2.07 KB 
Downloaded  106 Time(s) 

Last edited by greengeek on Sat 26 Oct 2013, 14:36; edited 2 times in total
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2502
Location: New Zealand

PostPosted: Fri 25 Oct 2013, 21:42    Post subject:  

voxclick003

This script and dic files are specific to mouseclick functionality. Command set as follows:
Code:
click
rightclick
centerclick
doubleclick
clickhold
release


thread here if problems:
http://murga-linux.com/puppy/viewtopic.php?t=89370
voxclick003.falsegz.gz
Description  This is the script to process the mouseclick commands.
Please remove the false gz suffixes.
gz

 Download 
Filename  voxclick003.falsegz.gz 
Filesize  587 Bytes 
Downloaded  98 Time(s) 
voxclick003_dic_files.tar.gz
Description  This is a genuine tar gz
Extract these into the /usr/share/pocketsphinx/model/lm
directory as loose files
gz

 Download 
Filename  voxclick003_dic_files.tar.gz 
Filesize  1000 Bytes 
Downloaded  113 Time(s) 
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2502
Location: New Zealand

PostPosted: Sun 27 Oct 2013, 04:41    Post subject: voxstarter004  

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:
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
voxstarter004.falsegz.gz
Description  Remove false gz suffixes
gz

 Download 
Filename  voxstarter004.falsegz.gz 
Filesize  2.17 KB 
Downloaded  100 Time(s) 
voxstarter004_dic_files.tar.gz
Description  This is a genuine tar gz.
Extract these files into /usr/share/pocketsphinx/model/lm
gz

 Download 
Filename  voxstarter004_dic_files.tar.gz 
Filesize  2.4 KB 
Downloaded  89 Time(s) 
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2502
Location: New Zealand

PostPosted: Fri 01 Nov 2013, 14:25    Post subject:
Subject description: voxmain001 dual menu prototype
 

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:
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:
voice-control-activate-complex
voice-control-activate-simple
(both commands are available in both modes)

complex mode command set is as follows:
Code:
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/gx9932mzlr0s7v0/chatterbox_voxmain001.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:.
.
voxmain001_scripts.tar.gz
Description  Extract all these scripts into /root
gz

 Download 
Filename  voxmain001_scripts.tar.gz 
Filesize  1.89 KB 
Downloaded  94 Time(s) 
voxmain001_dicfiles.tar.gz
Description  Extract these into /usr/shar/pocketsphinx/model/lm
gz

 Download 
Filename  voxmain001_dicfiles.tar.gz 
Filesize  4.44 KB 
Downloaded  90 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [8 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Projects
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0863s ][ Queries: 13 (0.0055s) ][ GZIP on ]