PageRenderTime 36ms CodeModel.GetById 15ms app.highlight 10ms RepoModel.GetById 3ms app.codeStats 0ms

/native/external/espeak/docs/add_language.html

http://eyes-free.googlecode.com/
HTML | 133 lines | 132 code | 1 blank | 0 comment | 0 complexity | b9de99128fa2c9d7425a8f45b3f06927 MD5 | raw file
  1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2<HTML>
  3<HEAD>
  4	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
  5	<TITLE>eSpeak: Adding a Language</TITLE>
  6</HEAD>
  7<BODY LANG="en-GB" DIR="LTR">
  8<A href="docindex.html">Back</A>
  9<HR>
 10<H2>6. ADDING OR IMPROVING A LANGUAGE</H2>
 11<HR>
 12Most of the work doesn't need any programming knowledge.  Just an understanding of the language, an
 13awareness of its features, patience and attention to detail.  Wikipedia is a good source of basic phonetic information, eg
 14<a href="http://en.wikipedia.org/wiki/Vowel">http://en.wikipedia.org/wiki/Vowel</a>
 15<P>
 16In many cases it should be fairly easy to add a rough implementation of a new language, hopefully
 17enough to be intelligible.<br>
 18After that it's a gradual process of improvement to:
 19<ul>
 20<li>Make the spelling-to-phoneme translation rules more accurate, including the position of stressed
 21syllables within words. Some languages are easier than others. I expect most are easier than English.
 22<p><li>Improve the sounds of the phonemes.  It may be that a phoneme should sound different depending on adjacent sounds, or whether it's at the start or the end of a word, between vowels, etc.  This may consist of making small adjustments to vowel and diphthong quality,
 23or adjusting the strength of consonants.  Bigger changes may be recording new or replacement consonant
 24sounds, or even writing program code to implement new types of sounds.
 25<p><li>Marking some common words in the dictionary that should be unstressed (words such as "the", "is"), or should be preceded
 26by a short pause (such as "and", "but"), or have other attributes, in order to make the speech flow better.
 27<p><li>Improve the rhythm of the speech by adjusting the relative lengths of vowels in different contexts, eg. stressed/unstressed syllable,
 28or depending on the following phonemes.  This is important for making the speech sound good for the language.
 29<p><li>Identify or implement new functions in the program to improve the speech, or to deal with
 30characteristics of the language which are not currently implemented.  For example, a different intonation module.
 31</ul>
 32<b><em>If you are interested in working on a language, please contact me to set up the initial data and to
 33discuss the features of the language.</em></b>
 34<p>
 35For most of the eSpeak voices, I do not speak or understand the language, and I do not know how it should sound.  I can only make improvements as a result of feedback from speakers of that language.  If you want to help to improve a language, listen carefully and try to identify individual errors, either in the spelling-to-phoneme translation, the position of stressed syllables within words, or the sound of phonemes, or problems with rhythm and vowel lengths.
 36<HR>
 37<H3>6.1 Language Code</H3>
 38<P>Generally, the language's international <a href="http://en.wikipedia.org/wiki/ISO_639-1">ISO 639-1 code</a> is used to
 39identify the language. It is used in the filenames which
 40contains the language's data. In the examples below the code &quot;<B>en</B>&quot;
 41(English) is used as an example. Replace this with the code of your
 42language.<p>
 43It is possible to have different variants of a language, for example where the sound of some phonemes changed,
 44or where some of the pronunciation rules differ.
 45<HR>
 46<H3>6.2 Phoneme File</H3>
 47<P>You must first decide on the set of phonemes to be used for the
 48language. These should be listed and defined in a phonemes file such as
 49<B>ph_english</B>. A reference to this file is then included at the end of
 50the <B>phonemes,</B> file (the master phoneme file), eg:</P>
 51<PRE>   phonemetable  en  base
 52   include  ph_english</PRE><P>
 53This example defines a phoneme table &quot;<B>en</B>&quot; which inherits
 54the contents of phoneme table &quot;<B>base</B>&quot;. Its contents are
 55found in the file <B>ph_english</B>.</P>
 56<P>The <B>base</B> phoneme table contains definitions of a basic set of
 57consonants, and also some &quot;control&quot; phonemes such as stress marks and
 58pauses. The phoneme table for a language will generally inherit this,
 59or alternatively it may inherit the phoneme table of another language
 60which in turn inherits the <B>base</B> phoneme table.</P>
 61<P>The phonemes file for the language defines those additional
 62phonemes which are not inherited (generally the vowels and diphthongs, plus any additional
 63consonants), or phonemes whose definitions differ from the
 64inherited version (eg. the redefinition of a consonant).</P>
 65<P>Details of the contents of phonemes files are given in
 66<A href="phontab.html">phontab.html</A>.</P>
 67The <B>Compile phoneme data</B> function of the <B>espeakedit</B>
 68program compiles the phonemes files to produce the files
 69<B>espeak-data/phontab</B>, <B>phonindex</B>, and <B>phondata.</B><P>
 70For information on how to analyse recorded sounds of the language and to
 71prepare the corresponding phoneme data, see <a href="editor_if.html">espeakedit</a> and <a href="analyse.html">analysis</a>).<p>
 72For an initial draft a language will often be able to use vowels and
 73consonants which have already been set up for another language.
 74<HR>
 75<H3>6.3 Dictionary Files</H3>
 76<P STYLE="font-weight: medium">Once the language's phonemes have been
 77defined, then pronunciation dictionary data can be produced in order
 78to translate the language's source text into phonemes. This consists
 79of two source files: <B>en_rules</B> (the spelling to phoneme rules) and
 80<B>en_list</B> (an exceptions list, and attributes of certain words). The corresponding compiled data
 81file is <B>espeak-data/en_dict</B> which is produced from <B>en_rules</B>
 82and <B>en_list</B> sources by the command: <B>speak&nbsp; --compile=en</B>.</P>
 83<P STYLE="font-weight: medium">Details of the contents of the
 84dictionary files are given in <A href="dictionary.html">dictionary.html</A>.</P>
 85<P STYLE="font-weight: medium">The <B>en_list</B> file contains not
 86only pronunciation exceptions, but also gives attributes to specific
 87words, Most notable of these are:</P>
 88<P STYLE="font-weight: medium"><B>$u </B>Some common words should be
 89marked as &quot;unstressed&quot; in order to make the speech flow better.
 90These words generally include articles (eg: a, the, this, that),
 91auxillary verbs (eg: is, have, will, can, may), pronouns and
 92possessive adjectives (eg: he, his), some common prepositions (eg:
 93of, to, in, of), some common conjunctions (eg. and, or, if)., some
 94common adverbs and adjectives (eg. any, already)</P>
 95<P><B>$pause </B>Some words should be marked to have a short pause
 96before then, in order to produce natural pauses in long sentences.
 97These include conjunctions (eg. and, or, but, however) and perhaps
 98some prepositions.</P>
 99<HR>
100<H3>6.4 Voice File</H3>
101<P STYLE="font-weight: medium">Each language should have one or more
102voice files in <B>espeak-data/voices</B>. The filename of the default voice
103for a language should be the same as the language code.</P>
104<P STYLE="font-weight: medium">Details of the contants of voice files
105are given in <A href="voices.html">voices.html</A>.</P>
106<P STYLE="font-weight: medium">The simplest voice file would contain
107just a single line to give the language code, eg:</P>
108<PRE STYLE="margin-bottom: 0.5cm">   language en</PRE><P STYLE="font-weight: medium">
109This language code specifies the phoneme table (i.e. <b>phonemetable  en</b> and the
110dictionary (i.e. <B>espeak-data/en_dict</B>) to be used. If needed, these can be
111overridden by <B>phonemes</B> and <B>dictionary</B> attributes in the
112voices file.</P>
113<HR>
114<H3>6.5 Program Code</H3>
115<P STYLE="font-weight: medium">The behaviour of the speak program is
116controlled by various options (eg. whether words are stressed on the first,
117last, or penultimate syllable). The function <B>SetTranslator()</B> at the
118start of the <B>tr_languages.cpp</B> file recognizes the language
119code and sets the appropriate set of options.</P>
120<P STYLE="font-weight: medium">For a new language, you would add its
121language code and the required options in <B>SetTranslator()</B>. However, this
122may not be necessary during testing because most of the options can also be
123set from the voice file in
124<B>espeak-data/voices</B>.</P>
125<P STYLE="font-weight: medium">If necessary, you can define a new
126translator class for a language, and select this in the
127SetTranslator() function. This inherits the standard functions
128from the base translator class, but allows you to replace these where
129needed by new functions which are written specially for this
130language.</P>
131
132</BODY>
133</HTML>