Packages / vocabulary

To get accurate speech-recognition results, the speech recognizer (Dragon) must be "taught" any new words or common sequences of words that you will speak. When coding or controlling the computer by voice, we use many words or phrases that are not in the common english lexicon.

The vocabulary package extends VoiceCode with several important features, and includes some basic default settings for each feature.

Individual vocabulary words

For simple words (or even short multiword phrases) that are not currently being recognized well, you can add them like this:

Settings.vocabulary = {
  vocabulary: [
    "is admin",
    "NPM install",
    "NPM run",
    "web view"

Vocabulary with alternate pronunciation

For words that are spoken significantly different than they are written, you can add vocabulary like this. This tells the speech recognizer that the pronunciation should be what is written on the left-hand side, while the actual word it should produce from that pronunciation is the right hand side. If individual letters need to be pronounced, make sure they are uppercased, as in "ES Six", and if numbers need to be spoken, they should be spelled out on the left-hand side.

Settings.vocabulary = {
  vocabularyAlternate: {
    "a sink": "async",
    "call D": "kaldi",
    "E numb": "enum",
    "ES Six": "es6",
    "node JS": "nodejs"

Common command sequences (bigrams)

Sometimes when combining multiple commands into longer phrases, certain combinations of commands are not easily recognized by dragon, or when combined, two commands might accidentally sound more like a different word. To boost recognition, we can "teach" Dragon common word/command sequences. For each entry, the left-hand-side is a word or command ID, and the right-hand side is an array of words or command IDs that would commonly follow the command on the left.

letters = _.values Settings.alphabet.letters

Settings.vocabulary = {
  sequences: {
    'common:delete': letters,
    'common:forward-delete': letters,
    'format:capitalize-next-word': ['hey'],
    'symbols:minus': letters,
    'user:commands:bloom': letters,
    'symbols:dot': [
    'mouse:double-click': [

Since it is common to say any of the "alphabet letters" after the certain commands, we demonstrated adding all the alphabet letters above.

Hint: to get the full command id of any command just say sherlock <command name> and it will type out the full name. For example sherlock smash will type format:lower-no-spaces


By "translations", we basically mean text substitutions. The substitution happens within VoiceCode, not within the speech recognizer. For example, if a word is commonly misspelled or formatted incorrectly by Dragon, it can be fixed on the VoiceCode side.

Take for example, the word "main". If you say the word by itself, it's probable that Dragon will most likely interpret it as "Maine". Or the phrase "et cetera", which you would probably want as "etc."

Settings.vocabulary = {
  translations: {
    "maine": "main",
    "et cetera": "etc."

Creative uses of translations

For simple text substitution, translations can also be used as quasi-commands in cases where the action only needs to type out text. For example if a project you worked on has some variable names that get used a lot (maybe "locationId"), instead of having to use a formatting command to format that variable every time, you could add a translation:

Settings.vocabulary = {
  translations: {
    "location id": "locationId",
    "user id": "userId"

Or if there is a word you can just never get Dragon to recognize properly, maybe "null", you could do something like this, using a more easily recognizable word to substitute for the troublesome word.

Settings.vocabulary = {
  translations: {
    "noel": "null"

Generated vocab files

In order for any vocabulary changes to affect Dragon's recognition algorithm, the generated vocabulary files must be imported into Dragon's vocabulary.

Based on the default settings plus any user-defined modifications, the vocabulary files are generated in a format that you can import into Dragon.

They are located at ~/voicecode/generated/<filename>.xml

Import vocab into Dragon

  • Open the Dragon drop-down menu and select "Edit Vocabulary"
  • Click on the "gear" icon, and choose "Import"

  • Select the generated xml vocabulary files in the ~/voicecode/generated folder.

  • Wait until the import finishes. Depending on your computer speed this could take up to 10 minutes or so on the first import. If it takes way too long, or Dragon crashes, repeat the steps but load a single xml vocabulary file at a time, instead of doing them all together.

results matching ""

    No results matching ""