mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-19 10:58:30 +00:00
Markdown document files cleaned up.
This commit is contained in:
+44
-31
@@ -1,5 +1,15 @@
|
||||
6. ADDING OR IMPROVING A LANGUAGE {.western}
|
||||
---------------------------------
|
||||
# Table of contents
|
||||
|
||||
* [Adding or improving a language](#adding-or-improving-a-language)
|
||||
* [Language Code](#language-code)
|
||||
* [Language Files](#language-files)
|
||||
* [Voice File](#voice-file)
|
||||
* [Phoneme Definition File](#phoneme-definition-file)
|
||||
* [Dictionary Files](#dictionary-files)
|
||||
* [Program Code](#program-code)
|
||||
* [Improving a Language](#improving-a-language)
|
||||
|
||||
# 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
|
||||
@@ -11,10 +21,9 @@ 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.
|
||||
|
||||
### 6.1 Language Code {.western}
|
||||
## Language Code
|
||||
|
||||
Generally, the language's international [ISO
|
||||
639-1](http://en.wikipedia.org/wiki/ISO_639-1) code is used to identify
|
||||
Generally, the language's international [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) code is used to identify
|
||||
the language. It is used in the filenames which contain the language's
|
||||
data. In the examples below the code **"fr"** is used as an example.
|
||||
Replace this with the code of your language.
|
||||
@@ -26,31 +35,28 @@ It is possible to have different variants of a language for different
|
||||
dialects. For example the sound of some phonemes are changed, or some of
|
||||
the pronunciation rules differ.
|
||||
|
||||
### 6.2 Language Files {.western}
|
||||
## Language Files
|
||||
|
||||
The following files are needed for your language.
|
||||
|
||||
- - - -
|
||||
|
||||
The **fr\_rules** and **fr\_list** files are compiled to produce the
|
||||
file **espeak-data/fr\_dict**, which eSpeak uses when it is speaking.
|
||||
|
||||
### 6.3 Voice File {.western}
|
||||
## Voice File
|
||||
|
||||
Each language needs a voice file in **espeak-data/voices** or
|
||||
**espeak-data/voices/test**. The filename of the default voice for a
|
||||
language should be the same as the language code (eg. "fr" for French).
|
||||
|
||||
Details of the contents of voice files are given in
|
||||
[voices.html](http://espeak.sf.net/voices.html).
|
||||
[voices](voices.md).
|
||||
|
||||
The simplest voice file would contain just 2 lines to give the language
|
||||
name and language code, eg:
|
||||
|
||||
~~~~ {.western}
|
||||
name french
|
||||
language fr
|
||||
~~~~
|
||||
name french
|
||||
language fr
|
||||
|
||||
This language code specifies which phoneme table and dictionary to use
|
||||
(i.e. **phonemetable fr** and **espeak-data/fr\_dict**) to be used. If
|
||||
@@ -59,7 +65,7 @@ attributes in the voice file. For example you may want to start the
|
||||
implementation of a new language by using the phoneme table of an
|
||||
existing language.
|
||||
|
||||
### 6.4 Phoneme Definition File {.western}
|
||||
## Phoneme Definition File
|
||||
|
||||
You must first decide on the set of phonemes (vowel and consonant
|
||||
sounds) for the language. These should be defined in a phoneme
|
||||
@@ -67,10 +73,8 @@ definition file **ph\_xxxx**, where "ph\_xxxx" is the name of your
|
||||
language. A reference to this file is then included at the end of the
|
||||
master phoneme file, **phsource/phonemes**, eg:
|
||||
|
||||
~~~~ {.western}
|
||||
phonemetable fr base
|
||||
include ph_french
|
||||
~~~~
|
||||
phonemetable fr base
|
||||
include ph_french
|
||||
|
||||
This example defines a phoneme table **"fr"** which inherits the
|
||||
contents of phoneme table **"base"**. Its contents are found in the file
|
||||
@@ -89,7 +93,7 @@ additional consonants that are needed), or phonemes whose definitions
|
||||
differ from the inherited version (eg. the redefinition of a consonant).
|
||||
|
||||
Details of phonemes files are given in
|
||||
[phontab.html](http://espeak.sf.net/phontab.html).
|
||||
[phontab](phontab.md).
|
||||
|
||||
The **Compile phoneme data** function of the **espeakedit** program
|
||||
compiles the phonemes files of all languages to produce the files
|
||||
@@ -101,7 +105,7 @@ in eSpeak, together with the available vowel files which can be used to
|
||||
define vowel phonemes, will be sufficient. At least for an initial
|
||||
implementation.
|
||||
|
||||
### 6.5 Dictionary Files {.western}
|
||||
## Dictionary Files
|
||||
|
||||
Once the language's phonemes have been defined, then pronunciation
|
||||
dictionary data can be produced in order to translate the language's
|
||||
@@ -111,23 +115,31 @@ exceptions list, and attributes of certain words). The corresponding
|
||||
compiled data file is **espeak-data/fr\_dict** which is produced from
|
||||
**fr\_rules** and **fr\_list** sources by the command:
|
||||
|
||||
> `espeak-ng --compile=fr`{.western}.
|
||||
`espeak-ng --compile=fr`
|
||||
|
||||
Or by using the **espeakedit** program.
|
||||
|
||||
Details of the contents of the dictionary files are given in
|
||||
[dictionary.html](http://espeak.sf.net/dictionary.html).
|
||||
[dictionary](dictionary.md).
|
||||
|
||||
The **fr\_list** file contains:
|
||||
|
||||
- - - -
|
||||
|
||||
### 6.6 Program Code {.western}
|
||||
* Pronunciations which exceptions to the rules in fr_rules, (eg. foreign names).
|
||||
* Pronunciation of letter names, symbol names, and punctuation names.
|
||||
* Pronunciation of numbers.
|
||||
* Attributes for words. For example, common function words which should not be stressed, or conjunctions which should be preceded by a pause.
|
||||
|
||||
## Program Code
|
||||
|
||||
The behaviour of the eSpeak program is controlled by various options
|
||||
such as:
|
||||
|
||||
- - - -
|
||||
|
||||
* Default rules for which syllable of a word has the main stress.
|
||||
* Relative lengths and amplitude of vowels in stressed and unstressed syllables.
|
||||
* Which intonation tunes to use.
|
||||
* Rules for speaking numbers.
|
||||
|
||||
The function SetTranslator() at the start of the source code file
|
||||
tr\_languages.cpp recognizes the language code and sets the appropriate
|
||||
@@ -135,18 +147,19 @@ 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 in the voice
|
||||
file in espeak-data/voices (see [Voice
|
||||
files](http://espeak.sf.net/voices.html)).
|
||||
files](voices.md)).
|
||||
|
||||
### 6.7 Improving a Language {.western}
|
||||
## Improving a Language
|
||||
|
||||
Listen carefully to the eSpeak voice. Try to identify what sounds wrong
|
||||
and what needs to be improved.
|
||||
|
||||
- - - - -
|
||||
|
||||
**If you are interested in working on a language, please contact me so
|
||||
that I can set up the initial data and discuss the features of the
|
||||
language.**
|
||||
* Make the spelling-to-phoneme translation rules more accurate, including the position of stressed syllables within words. Some languages are easier than others. I expect most are easier than English.
|
||||
* 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, in a stressed or unstressed syllable, etc. This may consist of making small adjustments to vowel and diphthong quality or length, or adjusting the strength of consonants. Phoneme definitions can include conditional statements which can be used to change the sound of a phoneme depending on its environment. Bigger changes may be recording new or replacement consonant sounds, or may even need program code to implement new types of sounds.
|
||||
* Some common words should be added to the dictionary (the fr_list file for the language) with an "unstressed" attribute **\$u** or **\$u+** (eg. in English, words such as "the", "is", "had", "my", "she", "of", "in", "some"), or should be preceded by a short pause (such as "and", "but", "which"), or have other attributes, in order to make the speech flow better.
|
||||
* Improve the rhythm of the speech by adjusting the relative lengths of vowels in different contexts, eg. stressed/unstressed syllable, or depending on the following phonemes. This is important for making the speech sound good for the language.
|
||||
* Make new intonation "tunes" for statements or questions (see [Intonation](intonation.md)).
|
||||
|
||||
For 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
|
||||
|
||||
Reference in New Issue
Block a user