Actions
Numbers and Spoken Forms
Unimacro and Vocola
Tracing
Inifiles
Translations
 How to start
 Callback logic
 Keystrokes
Cooperation with voicecoder
AutoHotkey
Unit testing
Grammar classes
Global dictation
Monitorfunctions

Translating grammars into other languages

See the demo movie, in this example the tasks grammar is translated into Dutch. (Note this translation has already been done, it is only meant as an example.)

The Unimacro grammar words can easily be translated into other speech recognition languages like Dutch, German, French, Italian, etc.

But in the same way also grammar keywords can be customised to your taste (synonyms).

The basics are as follows:

In the inifiles of the grammar (to be opened (in English) with edit grammarname, and inspected with show grammarname, (both being commands of the grammar control):

  • The section [grammar name] defines the spoken form of the grammar name.
  • The section [grammar words] holds the words of the grammar. After each word you can give your own synonym or translation. In many cases even more words can be given, separated by ;. If your synonyms have spaces inside, these are automatically quoted in the grammar specification.

Example from grammar repeat:

Consider the rules:

<acceleration> = [much] (faster | slower);
<speed> = [very] (fast|slow) | normal | steady;

The words much, faster, slower, very, fast, slow, normal, steady can all be changed into your translations or synonyms. If you want to include the word standard speed additional to normal, and a lot instead of much you can include in the grammar words section:

[grammar words]
...
much = a lot
normal = normal; standard speed
...

The rules then result in:

<acceleration> = [‘a lot’] (faster | slower);
<speed> = [very] (fast|slow) | normal|‘standard speed’ | steady;

Warning:

In some cases making more synonyms can result in invalid rules, although most grammars are designed to prevent this.

Consider the following rule from the grammar lines (_lines.py):

<lines> = line |
          {count} lines |
          (previous|next|this|these) (line | {count} lines);

If you want to make synonyms for the grammar words line and lines, like:

[grammar words]
...
line = line; lying
lines = lines; lyings
...

The rule results in:

<lines> = line|lying |
          {count} lines|lyings |
          (previous|next|this|these) (line|lying | {count} lines|lyings);

Which gives unwanted results. However most grammars will be designed to prevent these errors.

Changing the order of words

This translation trick is only meant for literal words. So first get confident with the simple trick. Note: the names of rules and lists remain unchanged!

If you want to change your grammar with another word order, you have to copy your grammar specification into the python file for your specific language. It can be done but possibly more work has to be done to interpret correct recognition results in the callback functions. (Example of this in the grammar _repeat.py for the Dutch case).