Back

6. ADDING OR IMPROVING A LANGUAGE


Most of the work doesn't need any programming knowledge. Just an understanding of the language, an awareness of its features, patience and attention to detail. Wikipedia is a good source of basic phonetic information, eg http://en.wikipedia.org/wiki/Vowel

In many cases it should be fairly easy to add a rough implementation of a new language, hopefully enough to be intelligible.
After that it's a gradual process of improvement to:

If you are interested in working on a language, please contact me to set up the initial data and to discuss the features of the language.

6.1 Language Code

Generally, the language's international ISO 639-1 code is used to identify the language. It is used in the filenames which contains the language's data. In the examples below the code "en" (English) is used as an example. Replace this with the code of your language.

It is possible to have different variants of a language, for example where the sound of some phonemes changed, or where some of the pronunciation rules differ.


6.2 Phoneme File

You must first decide on the set of phonemes to be used for the language. These should be listed and defined in a phonemes file such as ph_english. A reference to this file is then included at the end of the phonemes, file (the master phoneme file), eg:

   phonemetable  en  base
   include  ph_english

This example defines a phoneme table "en" which inherits the contents of phoneme table "base". Its contents are found in the file ph_english.

The base phoneme table contains definitions of a basic set of consonants, and also some "control" phonemes such as stress marks and pauses. The phoneme table for a language will generally inherit this, or alternatively it may inherit the phoneme table of another language which in turn inherits the base phoneme table.

The phonemes file for the language defines those additional phonemes which are not inherited (generally the vowels and diphthongs, plus any additional consonants), or phonemes whose definitions differ from the inherited version (eg. the redefinition of a consonant).

Details of the contents of phonemes files are given in phontab.html.

The Compile phoneme data function of the espeakedit program compiles the phonemes files to produce the files espeak-data/phontab, phonindex, and phondata.

For information on how to analyse recorded sounds of the language and to prepare the corresponding phoneme data, see (not yet written).

For an initial draft a language will often be able to use vowels and consonants which have already been set up for another language.


6.3 Dictionary Files

Once the language's phonemes have been defined, then pronunciation dictionary data can be produced in order to translate the language's source text into phonemes. This consists of two source files: en_rules (the spelling to phoneme rules) and en_list (an exceptions list, and attributes of certain words). The corresponding compiled data file is espeak-data/en_dict which is produced from en_rules and en_list sources by the command: speak  --compile=en.

Details of the contents of the dictionary files are given in dictionary.html.

The en_list file contains not only pronunciation exceptions, but also gives attributes to specific words, Most notable of these are:

$u Some common words should be marked as "unstressed" in order to make the speech flow better. These words generally include articles (eg: a, the, this, that), auxillary verbs (eg: is, have, will, can, may), pronouns and possessive adjectives (eg: he, his), some common prepositions (eg: of, to, in, of), some common conjunctions (eg. and, or, if)., some common adverbs and adjectives (eg. any, already)

$pause Some words should be marked to have a short pause before then, in order to produce natural pauses in long sentences. These include conjunctions (eg. and, or, but, however) and perhaps some prepositions.


6.4 Voice File

Each language should have one or more voice files in espeak-data/voices. The filename of the default voice for a language should be the same as the language code.

Details of the contants of voice files are given in voices.html.

The simplest voice file would contain just a single line to give the language code, eg:

   language en

This language code specifies the phoneme table (i.e. phonemetable en and the dictionary (i.e. espeak-data/en_dict) to be used. If needed, these can be overridden by phonemes and dictionary attributes in the voices file.


6.5 Program Code

The behaviour of the speak program is controlled by various options (eg. whether words are stressed on the first, last, or penultimate syllable). The function SetTranslator() at the start of the tr_languages.cpp file recognizes the language code and sets the appropriate set of options.

For a new language, you would add its language code and the required options in SetTranslator(). However, this may not be necessary during testing because most of the options can also be set from the voice file in espeak-data/voices.

If necessary, you can define a new translator class for a language, and select this in the SetTranslator() function. This inherits the standard functions from the base translator class, but allows you to replace these where needed by new functions which are written specially for this language.