Home

Awesome

Isabella

Isabella is my first foray into voice computing. When I'm using my Apple headphones or the Blue Yeti mic in cardioid mode, Isabella does a fantastic job at recognizing commands, but is a little over-sensitive. When you're working from home, alone, in silence, then occasionally talk to your computer, it works great! When other people are around or if you start talking to yourself, she'll get over-zealous and tell you jokes you didn't ask for.

Installation

See the pocketsphinx-ruby docs for instructions installing the latest dev versions of Pocketsphinx and Sphinxbase.

Once that's done, just bundle install to install the relevant Ruby libraries.

Configuration

This is more complicated than it should be. For speech recognition, we have three different files:

config/commands.yml

This file contains a list of commands that Isabella responds to. Each command contains a regex pattern for matching, then a script that should be run when that command is recognized. For example:

-
  pattern: 'tell me (?:the|a) joke(?: (?:with|about) ?(?:a|the)? ([\w\s]+))?'
  script: sayjoke

Each script is assumed to be a .rb file residing in the scripts directory in the root of the project.

config/grammar.gram

This file contains a grammer of valid language, in the JSGF format. It defines valid sentences and components that those sentences are made up of. For example:

#JSGF V1.0;

grammar isabella;

public <sentence> = hey isabella <command>;

<command> = tell me a joke | tell me <article> joke <joke-preposition> [<article>] <joke-reference>;

<article> = a | the;

<joke-preposition> = with | about;

<joke-reference> =  orion | etymologist | bar | pessimist | funerals;

You can find quite good documentation on the format of this file here. It should also be noted that every word included in this file must be defined in the dictionary file, described in the next section.

config/dictionary.dic

This file contains a list of words with pronunciations in North American English, which judging by the source of the library (Carnegie Mellon University) and extremely limited set of phonemes, probably means some kind of north-east US, academic accent that someone decided is the correct/standard/average way for North Americans to speak English. Whatever. It's free! :smiley:

For some reason, instead of using an existing and more complete list of phonemes for recognizing speech, such as the International Phonetic Alphabet, CMU is using a transcription code called Arpabet, which seems to be designed not for speech recognition, but for speech synthesis. On top of that, CMU supports only a subset of Arpabet's phonemes and also doesn't support its lexical stress markers. Oh well.

Instead of linking to docs showing you how to use this file, I'll save you the time piecing together instructions from several, sometimes contradictory sources and just show you what actually works.

To define the pronunciation for a word, just type the word, then a space, then each phoneme in the word separated by a space. For example:

hey HH EY
isabella IH Z AA B EH L AA

This is a complete list of phonemes you can use:

PhonemeExampleTranslation
AAoddAA D
AEatAE T
AHhutHH AH T
AOoughtAO T
AWcowK AW
AYhideHH AY D
BbeB IY
CHcheeseCH IY Z
DdeeD IY
DHtheeDH IY
EHEdEH D
ERhurtHH ER T
EYateEY T
FfeeF IY
GgreenG R IY N
HHheHH IY
IHitIH T
IYeatIY T
JHgeeJH IY
KkeyK IY
LleeL IY
MmeM IY
NkneeN IY
NGpingP IH NG
OWoatOW T
OYtoyT OY
PpeeP IY
RreadR IY D
SseaS IY
SHsheSH IY
TteaT IY
THthetaTH EY T AH
UHhoodHH UH D
UWtwoT UW
VveeV IY
WweW IY
YyieldY IY L D
ZzeeZ IY
ZHseizureS IY ZH ER

All alternate pronunciations must be marked with paranthesized serial numbers starting from (2) for the second pronunciation. The marker (1) is omitted. For example:

directing    D AY R EH K T IH NG
directing(2) D ER EH K T IH NG
directing(3) D IH R EH K T IH NG

Usage

bundle exec rake listen

That'll tell Isabella to start listening for commands. Just Ctrl-C when you want her to stop.

Ideas for increasing accuracy