mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
Markdown document files cleaned up.
This commit is contained in:
+283
-222
@@ -1,49 +1,75 @@
|
||||
4. TEXT TO PHONEME TRANSLATION {.western}
|
||||
------------------------------
|
||||
# Table of contents
|
||||
|
||||
### 4.1 Translation Files {.western}
|
||||
* [Text to phoneme translation](#text-to-phoneme-translation)
|
||||
* [Translation Files](#translation-files)
|
||||
* [Phoneme names](#phoneme-names)
|
||||
* [Pronunciation Rules](#pronunciation-rules)
|
||||
* [Rule Groups](#rule-groups)
|
||||
* [Rules](#rules)
|
||||
* [Special characters in \<phoneme string\>](#special-characters-in-phoneme-string)
|
||||
* [Special Characters in both \<pre\> and \<post\> ](#special-characters-in-both-pre-and-post)
|
||||
* [Special characters only in \<pre\> ](#special-characters-only-in-pre)
|
||||
* [Special characters only in \<post\> ](#special-characters-only-in-post)
|
||||
* [Pronunciation Dictionary List](#pronunciation-dictionary-list)
|
||||
* [Multiple Words](#multiple-words)
|
||||
* [Special characters in \<phoneme string\>](#special-characters-in-phoneme-string)
|
||||
* [Flags](#flags)
|
||||
* [Translating a Word to another Word](#translating-a-word-to-another-word)
|
||||
* [Conditional Rules](#conditional-rules)
|
||||
* [Numbers and Character Names](#numbers-and-character-names)
|
||||
* [Letter names](#letter-names)
|
||||
* [Numbers](#numbers)
|
||||
* [Character Substitution](#character-substitution)
|
||||
|
||||
# Text to phoneme translation
|
||||
|
||||
|
||||
## Translation Files
|
||||
|
||||
There is a separate set of pronunciation files for each language, their
|
||||
names starting with the language name.
|
||||
|
||||
There are two separate methods for translating words into phonemes:
|
||||
|
||||
- -
|
||||
* Pronunciation Rules. These are an attempt to define the pronunciation rules for the language. The source file is:
|
||||
**\<language\>\_rules** (eg. `en_rules`)
|
||||
|
||||
These two files are compiled into the file ***\<language\>\_dict*** in
|
||||
the espeak-data directory (eg. espeak-data/en\_dict)
|
||||
* Lookup Dictionary. A list of individual words and their pronunciations and/or various other properties. The source files are:
|
||||
**\<language\>\_list** (eg. `en_list`) and optionally **\<language\>\_extra**.
|
||||
|
||||
### 4.2 Phoneme names {.western}
|
||||
These two files are compiled into the file **\<language\>\_dict** in
|
||||
the espeak-data directory (eg. `espeak-data/en_dict`)
|
||||
|
||||
## Phoneme names
|
||||
|
||||
Each of the language's phonemes is represented by a mnemonic of 1, 2, 3,
|
||||
or 4 characters. Together with a number of utility codes (eg. stress
|
||||
marks and pauses), these are defined in the phoneme data file (see
|
||||
\*spec not yet available\*).
|
||||
marks and pauses), these are defined in the phoneme data file (_TODO_).
|
||||
|
||||
The utility 'phonemes' are:
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **'** | primary stress |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **,** | secondary stress |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **%** | unstressed syllable |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **= ** | put the primary stress on the |
|
||||
| | preceding syllable |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **\_:** | short pause |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **\_** | a shorter pause |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **||** | indicates a word boundary within a |
|
||||
| | phoneme string |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **|** | can be used to separate two adjacent |
|
||||
| | characters, to prevent them from |
|
||||
| | being considered as a |
|
||||
| | multi-character phoneme mnemonic |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
+-----------+--------------------------------------+
|
||||
| **'** | primary stress |
|
||||
+-----------+--------------------------------------+
|
||||
| **,** | secondary stress |
|
||||
+-----------+--------------------------------------+
|
||||
| **%** | unstressed syllable |
|
||||
+-----------+--------------------------------------+
|
||||
| **=** | put the primary stress on the |
|
||||
| | preceding syllable |
|
||||
+-----------+--------------------------------------+
|
||||
| **\_:** | short pause |
|
||||
+-----------+--------------------------------------+
|
||||
| **\_** | a shorter pause |
|
||||
+-----------+--------------------------------------+
|
||||
| **||** | indicates a word boundary within a |
|
||||
| | phoneme string |
|
||||
+-----------+--------------------------------------+
|
||||
| **|** | can be used to separate two adjacent |
|
||||
| | characters, to prevent them from |
|
||||
| | being considered as a |
|
||||
| | multi-character phoneme mnemonic |
|
||||
+-----------+--------------------------------------+
|
||||
|
||||
It is not necessary to specify the stress of every syllable. Stress
|
||||
markers are only needed in order to change the effect of the language's
|
||||
@@ -54,9 +80,11 @@ loosely on the Kirshenbaum ascii character representation of the
|
||||
International Phonetic Alphabet
|
||||
[www.kirshenbaum.net/IPA/ascii-ipa.pdf](http://www.kirshenbaum.net/IPA/ascii-ipa.pdf)
|
||||
|
||||
### 4.3 Pronunciation Rules {.western}
|
||||
Full list of commonly used phonemes can be found in [phsource/phonemes](../phsource/phonemes) file.
|
||||
|
||||
The rules in the ***\<language\>\_rules*** file specify the phonemes
|
||||
## Pronunciation Rules
|
||||
|
||||
The rules in the **\<language\>\_rules** file specify the phonemes
|
||||
which are used to pronounce each letter, or sequence of letters. Some
|
||||
rules only apply when the letter or letters are preceded by, or followed
|
||||
by, other specified letters.
|
||||
@@ -68,21 +96,52 @@ matching rule is chosen. The pointer into the source word is then
|
||||
advanced past those letters which have been matched and the process is
|
||||
repeated until all the letters of the word have been processed.
|
||||
|
||||
#### 4.3.1 Rule Groups {.western}
|
||||
### Rule Groups
|
||||
|
||||
The rules are organized in groups, each starting with a ".group" line:
|
||||
|
||||
**.group \<character\>**
|
||||
|
||||
> A group for each letter or character.
|
||||
|
||||
**.group \<2 characters\>**
|
||||
|
||||
> Optional groups for some common 2 letter combinations. This is only needed, for efficiency, in cases where there are many rules for a particular letter. They would not be needed for a language which has regular spelling rules. The first character can only be an ascii character (less than 0x80).
|
||||
|
||||
**.group**
|
||||
|
||||
> A group for other characters which don't have their own group.
|
||||
|
||||
**.L\<nn\>**
|
||||
|
||||
> Defines a group of letter sequences, any of which can match with Lnn in a pre or post rule (see below). nn is a 2 digit decimal number in the range 01 to 25. eg:
|
||||
`.L01 b bl br pl pr`
|
||||
|
||||
**.replace**
|
||||
|
||||
> See section [Character Substitution](#character-substitution).
|
||||
|
||||
|
||||
When matching a word, firstly the 2-letter group for the two letters at
|
||||
the current position in the word (if such a group exists) is searched,
|
||||
and then the single-letter group. The highest scoring rule in either of
|
||||
those two groups is used.
|
||||
|
||||
#### 4.3.2 Rules {.western}
|
||||
### Rules
|
||||
|
||||
Each rule is on separate line, and has the syntax:
|
||||
|
||||
`[<pre>)] <match> [(<post>] <phoneme string>`
|
||||
|
||||
eg.
|
||||
|
||||
```
|
||||
.group o
|
||||
o 0 // "o" is pronounced as [0]
|
||||
oo u: // but "oo" is pronounced as [u:]
|
||||
b) oo (k U
|
||||
```
|
||||
|
||||
"oo" is pronounced as [u:], but when also preceded by "b" and followed
|
||||
by "k", it is pronounced [U].
|
||||
|
||||
@@ -95,140 +154,142 @@ Alphabetic characters in the \<pre\>, \<match\>, and \<post\> parts must
|
||||
be lower case, and matching is case-insensitive. Some upper case letters
|
||||
are used in \<pre\> and \<post\> with special meanings.
|
||||
|
||||
#### 4.3.3 Special characters in \<phoneme string\>: {.western}
|
||||
### Special characters in \<phoneme string\>:
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **\_\^\_\<language code\> ** | Translate using a different |
|
||||
| | language. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
|
||||
#### 4.3.4 Special Characters in both \<pre\> and \<post\>: {.western}
|
||||
**_^_\<language code\>**
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **\_** | Beginning or end of a word (or a |
|
||||
| | hyphen). |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **-** | Hyphen. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **A** | Any vowel (the set of vowel |
|
||||
| | characters may be defined for a |
|
||||
| | particular language). |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **C** | Any consonant. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **B H F G Y ** | These may indicate other sets of |
|
||||
| | characters (defined for a particular |
|
||||
| | language). |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **L\<nn\>** | Any of the sequence of characters |
|
||||
| | defined as a letter group (see 4.3.1 |
|
||||
| | above). |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **D** | Any digit. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **K** | Not a vowel (i.e. a consonant or |
|
||||
| | word boundary or non-alphabetic |
|
||||
| | character). |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **X** | There is no vowel until the word |
|
||||
| | boundary. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **Z** | A non-alphabetic character. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **%** | Doubled (placed before a character |
|
||||
| | in \<pre\> and after it in \<post\>. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **/** | The following character is treated |
|
||||
| | literally. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
> Translate using a different language.
|
||||
If this rule is selected when translating a word, then the translation is aborted and the word is re-translated using the specified different language. \<language code\> may be upper or lower case. This can be used to recognise certain letter combinations as being foreign words and to use the foreign pronunciation for them. eg:
|
||||
`th (_ _^_EN`
|
||||
|
||||
indicates that a word which ends in "th" is translated using the English translation rules and spoken with English phonemes.
|
||||
|
||||
### Special Characters in both \<pre\> and \<post\>
|
||||
|
||||
+------------------+--------------------------------------+
|
||||
| **\_** | Beginning or end of a word (or a |
|
||||
| | hyphen). |
|
||||
+------------------+--------------------------------------+
|
||||
| **-** | Hyphen. |
|
||||
+------------------+--------------------------------------+
|
||||
| **A** | Any vowel (the set of vowel |
|
||||
| | characters may be defined for a |
|
||||
| | particular language). |
|
||||
+------------------+--------------------------------------+
|
||||
| **C** | Any consonant. |
|
||||
+------------------+--------------------------------------+
|
||||
| **B H F G Y** | These may indicate other sets of |
|
||||
| | characters (defined for a particular |
|
||||
| | language). |
|
||||
+------------------+--------------------------------------+
|
||||
| **L\<nn\>** | Any of the sequence of characters |
|
||||
| | defined as a letter group (see 1 |
|
||||
| | above). |
|
||||
+------------------+--------------------------------------+
|
||||
| **D** | Any digit. |
|
||||
+------------------+--------------------------------------+
|
||||
| **K** | Not a vowel (i.e. a consonant or |
|
||||
| | word boundary or non-alphabetic |
|
||||
| | character). |
|
||||
+------------------+--------------------------------------+
|
||||
| **X** | There is no vowel until the word |
|
||||
| | boundary. |
|
||||
+------------------+--------------------------------------+
|
||||
| **Z** | A non-alphabetic character. |
|
||||
+------------------+--------------------------------------+
|
||||
| **%** | Doubled (placed before a character |
|
||||
| | in \<pre\> and after it in \<post\>. |
|
||||
+------------------+--------------------------------------+
|
||||
| **/** | The following character is treated |
|
||||
| | literally. |
|
||||
+------------------+--------------------------------------+
|
||||
|
||||
The sets of letters indicated by A, B, C, E, F G may be defined
|
||||
differently for each language.
|
||||
|
||||
Examples of rules:
|
||||
|
||||
~~~~ {.western}
|
||||
```
|
||||
_) a // "a" at the start of a word
|
||||
a (CC // "a" followed by two consonants
|
||||
a (C% // "a" followed by a double consonant (the same letter twice)
|
||||
a (/% // "a" followed by a percent sign
|
||||
%C) a // "a" preceded by a double consonants
|
||||
~~~~
|
||||
```
|
||||
|
||||
#### 4.3.5 Special characters only in \<pre\>: {.western}
|
||||
### Special characters only in \<pre\>:
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **@ ** | Any syllable. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **&** | A syllable which may be stressed |
|
||||
| | (i.e. is not defined as unstressed). |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **V** | Matches only if a previous word has |
|
||||
| | indicated that a verb form is |
|
||||
| | expected. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
+-----------------+--------------------------------------+
|
||||
| **@** | Any syllable. |
|
||||
+-----------------+--------------------------------------+
|
||||
| **&** | A syllable which may be stressed |
|
||||
| | (i.e. is not defined as unstressed). |
|
||||
+-----------------+--------------------------------------+
|
||||
| **V** | Matches only if a previous word has |
|
||||
| | indicated that a verb form is |
|
||||
| | expected. |
|
||||
+-----------------+--------------------------------------+
|
||||
|
||||
eg.
|
||||
|
||||
~~~~ {.western}
|
||||
```
|
||||
@@) bi // "bi" preceded by at least two syllables
|
||||
@@a) bi // "bi" preceded by at least 2 syllables and following 'a'
|
||||
~~~~
|
||||
```
|
||||
|
||||
Note, that matching characters in the \<pre\> part do not affect the
|
||||
syllable counting.
|
||||
|
||||
#### 4.3.6 Special characters only in \<post\>: {.western}
|
||||
### Special characters only in \<post\>
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **@** | A vowel follows somewhere in the |
|
||||
| | word. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **+** | Force an increase in the score in |
|
||||
| | this rule (may be repeated for more |
|
||||
| | effect). |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **S\<number\> ** | This number of matching characters |
|
||||
| | are a standard suffix, remove them |
|
||||
| | and retranslate the word. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **P\<number\>** | This number of matching characters |
|
||||
| | are a standard prefix, remove them |
|
||||
| | and retranslate the word. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **Lnn** | **nn** is a 2-digit decimal number |
|
||||
| | in the range 01 to 20\ |
|
||||
| | Matches with any of the letter |
|
||||
| | sequences which have been defined |
|
||||
| | for letter group **nn** |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **N** | Only use this rule if the word is |
|
||||
| | not a retranslation after removing a |
|
||||
| | suffix. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **\#** | (English specific) change the next |
|
||||
| | "e" into a special character "E" |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **\$noprefix** | Only use this rule if the word is |
|
||||
| | not a retranslation after removing a |
|
||||
| | prefix. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **\$w\_alt\ | Only use this rule if the word is |
|
||||
| \$w\_alt2\ | found in the \*\_list file with the |
|
||||
| \$w\_alt3** | **\$alt**, **\$alt2** or **\$alt3** |
|
||||
| | attribute respectively. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **\$p\_alt\ | Only use this rule if the part-word, |
|
||||
| \$p\_alt2\ | up to and including the pre and |
|
||||
| \$p\_alt3** | match parts of this rule, is found |
|
||||
| | in the \*\_list file with the |
|
||||
| | **\$alt**, **\$alt2** or **\$alt3** |
|
||||
| | attribute respectively. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
+--------------------+--------------------------------------+
|
||||
| **@** | A vowel follows somewhere in the |
|
||||
| | word. |
|
||||
+--------------------+--------------------------------------+
|
||||
| **+** | Force an increase in the score in |
|
||||
| | this rule (may be repeated for more |
|
||||
| | effect). |
|
||||
+--------------------+--------------------------------------+
|
||||
| **S\<number\>** | This number of matching characters |
|
||||
| | are a standard suffix, remove them |
|
||||
| | and retranslate the word. |
|
||||
+--------------------+--------------------------------------+
|
||||
| **P\<number\>** | This number of matching characters |
|
||||
| | are a standard prefix, remove them |
|
||||
| | and retranslate the word. |
|
||||
+--------------------+--------------------------------------+
|
||||
| **Lnn** | **nn** is a 2-digit decimal number |
|
||||
| | in the range 01 to 20\ |
|
||||
| | Matches with any of the letter |
|
||||
| | sequences which have been defined |
|
||||
| | for letter group **nn** |
|
||||
+--------------------+--------------------------------------+
|
||||
| **N** | Only use this rule if the word is |
|
||||
| | not a retranslation after removing a |
|
||||
| | suffix. |
|
||||
+--------------------+--------------------------------------+
|
||||
| **\#** | (English specific) change the next |
|
||||
| | "e" into a special character "E" |
|
||||
+--------------------+--------------------------------------+
|
||||
| **\$noprefix** | Only use this rule if the word is |
|
||||
| | not a retranslation after removing a |
|
||||
| | prefix. |
|
||||
+--------------------+--------------------------------------+
|
||||
| **\$w\_alt\ | Only use this rule if the word is |
|
||||
| \$w\_alt2\ | found in the \*\_list file with the |
|
||||
| \$w\_alt3** | **\$alt**, **\$alt2** or **\$alt3** |
|
||||
| | attribute respectively. |
|
||||
+--------------------+--------------------------------------+
|
||||
| **\$p\_alt\ | Only use this rule if the part-word, |
|
||||
| \$p\_alt2\ | up to and including the pre and |
|
||||
| \$p\_alt3** | match parts of this rule, is found |
|
||||
| | in the \*\_list file with the |
|
||||
| | **\$alt**, **\$alt2** or **\$alt3** |
|
||||
| | attribute respectively. |
|
||||
+--------------------+--------------------------------------+
|
||||
|
||||
eg.
|
||||
|
||||
~~~~ {.western}
|
||||
```
|
||||
@) ly (_S2 lI // "ly", at end of a word with at least one other
|
||||
// syllable, is a suffix pronounced [lI]. Remove
|
||||
// it and retranslate the word.
|
||||
@@ -237,7 +298,7 @@ eg.
|
||||
// prefix pronounced [Vn]
|
||||
_) un (i ju: // ... except in words starting "uni"
|
||||
_) un (inP2 ,Vn // ... but it is for words starting "unin"
|
||||
~~~~
|
||||
```
|
||||
|
||||
S and P must be at the end of the \<post\> string.
|
||||
|
||||
@@ -245,49 +306,49 @@ S\<number\> may be followed by additional letters (eg. S2ei ). Some of
|
||||
these are probably specific to English, but similar functions could be
|
||||
made for other languages.
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **q** | query the \_list file to find stress |
|
||||
| | position or other attributes for the |
|
||||
| | stem, but don't re-translate the |
|
||||
| | word with the suffix removed. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **t** | determine the stress pattern of the |
|
||||
| | word **before** adding the suffix |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **d ** | the previous letter may have been |
|
||||
| | doubled when the suffix was added. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **e** | "e" may have been removed. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **i** | "y" may have been changed to "i." |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **v** | the suffix means the verb form of |
|
||||
| | pronunciation should be used. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **f** | the suffix means the next word is |
|
||||
| | likely to be a verb. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **m** | after this suffix has been removed, |
|
||||
| | additional suffixes may be removed. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
+-------+--------------------------------------+
|
||||
| **q** | query the \_list file to find stress |
|
||||
| | position or other attributes for the |
|
||||
| | stem, but don't re-translate the |
|
||||
| | word with the suffix removed. |
|
||||
+-------+--------------------------------------+
|
||||
| **t** | determine the stress pattern of the |
|
||||
| | word **before** adding the suffix |
|
||||
+-------+--------------------------------------+
|
||||
| **d** | the previous letter may have been |
|
||||
| | doubled when the suffix was added. |
|
||||
+-------+--------------------------------------+
|
||||
| **e** | "e" may have been removed. |
|
||||
+-------+--------------------------------------+
|
||||
| **i** | "y" may have been changed to "i." |
|
||||
+-------+--------------------------------------+
|
||||
| **v** | the suffix means the verb form of |
|
||||
| | pronunciation should be used. |
|
||||
+-------+--------------------------------------+
|
||||
| **f** | the suffix means the next word is |
|
||||
| | likely to be a verb. |
|
||||
+-------+--------------------------------------+
|
||||
| **m** | after this suffix has been removed, |
|
||||
| | additional suffixes may be removed. |
|
||||
+-------+--------------------------------------+
|
||||
|
||||
P\<number\> may be followed by additonal letters (eg. P3v ).
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **t ** | determine the stress pattern of the |
|
||||
| | word **before** adding the prefix |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **v** | the suffix means the verb form of |
|
||||
| | pronunciation should be used. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
+--------+--------------------------------------+
|
||||
| **t** | determine the stress pattern of the |
|
||||
| | word **before** adding the prefix |
|
||||
+--------+--------------------------------------+
|
||||
| **v** | the suffix means the verb form of |
|
||||
| | pronunciation should be used. |
|
||||
+--------+--------------------------------------+
|
||||
|
||||
### 4.4 Pronunciation Dictionary List {.western}
|
||||
## Pronunciation Dictionary List
|
||||
|
||||
The ***\<language\>\_list*** file contains a list of words whose
|
||||
The **\<language\>\_list** file contains a list of words whose
|
||||
pronunciations are given explicitly, rather than determined by the
|
||||
Pronunciation Rules. The ***\<language\>\_extra*** file, if present, is
|
||||
Pronunciation Rules. The **\<language\>\_extra** file, if present, is
|
||||
also used and it's contents are taken as coming after those in
|
||||
***\<language\>\_list***.
|
||||
**\<language\>\_list**.
|
||||
|
||||
Also the list can be used to specify the stress pattern, or other
|
||||
properties, of a word.
|
||||
@@ -298,57 +359,59 @@ Dictionary List after the prefix or suffix has been removed.
|
||||
|
||||
Lines in the dictionary list have the form:
|
||||
|
||||
eg.
|
||||
```
|
||||
<word> [<phoneme string>] [<flags>]
|
||||
```
|
||||
|
||||
~~~~ {.western style="margin-bottom: 0.5cm"}
|
||||
eg.
|
||||
```
|
||||
book bUk
|
||||
~~~~
|
||||
```
|
||||
|
||||
Rather than a full pronunciation, just the stress may be given, to
|
||||
change where it would be otherwise placed by the Pronunciation Rules:
|
||||
|
||||
~~~~ {.western}
|
||||
```
|
||||
berlin $2 // stress on second syllable
|
||||
absolutely $3 // stress on third syllable
|
||||
for $u // an unstressed word
|
||||
~~~~
|
||||
```
|
||||
|
||||
#### 4.4.1 Multiple Words {.western}
|
||||
### Multiple Words
|
||||
|
||||
A pronunciation may also be specified for a group of words, when these
|
||||
appear together. Up to four words may be given, enclosed in brackets.
|
||||
This may be used for change the pronunciation or stress pattern when
|
||||
these words occur together,
|
||||
|
||||
~~~~ {.western style="margin-bottom: 0.5cm"}
|
||||
```
|
||||
(de jure) deI||dZ'U@rI2 // note || used as a word break in the phoneme string
|
||||
~~~~
|
||||
```
|
||||
|
||||
or to run them together, pronounced as a single word
|
||||
|
||||
~~~~ {.western style="margin-bottom: 0.5cm"}
|
||||
```
|
||||
(of a) @v@
|
||||
~~~~
|
||||
```
|
||||
|
||||
or to give them a flag when they occur together
|
||||
|
||||
~~~~ {.western style="margin-bottom: 0.5cm"}
|
||||
```
|
||||
(such as) sVtS||a2z $pause // precede with a pause
|
||||
~~~~
|
||||
```
|
||||
|
||||
Hyphenated words in the ***\<language\>\_list*** file must also be
|
||||
Hyphenated words in the **\<language\>\_list** file must also be
|
||||
enclosed within brackets, because the two parts are considered as
|
||||
separate words.
|
||||
|
||||
#### 4.4.2 Special characters in \<phoneme string\>: {.western}
|
||||
### Special characters in \<phoneme string\>:
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| **\_\^\_\<language code\> ** | Translate using a different |
|
||||
| | language. See explanation in 4.3.3 |
|
||||
| **\_\^\_\<language code\>** | Translate using a different |
|
||||
| | language. See explanation in 3 |
|
||||
| | above. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
|
||||
#### 4.4.3 Flags {.western}
|
||||
### 3 Flags
|
||||
|
||||
A word (or group of words) may be given one or more flags, either
|
||||
instead of, or as well as, the phonetic translation.
|
||||
@@ -449,12 +512,12 @@ instead of, or as well as, the phonetic translation.
|
||||
| | end of a sentence. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| \$abbrev | This has two meanings.\ |
|
||||
| | 1. If there is no phoneme string: |
|
||||
| | If there is no phoneme string: |
|
||||
| | Speak the word as individual |
|
||||
| | letters, even if it contains a vowel |
|
||||
| | (eg. "abc" should be spoken as "a" |
|
||||
| | "b" "c").\ |
|
||||
| | 2. If there is a phoneme string: |
|
||||
| | If there is a phoneme string: |
|
||||
| | This word is capitalized because it |
|
||||
| | is an abbreviation and |
|
||||
| | capitalization does not indicate |
|
||||
@@ -517,35 +580,33 @@ The dictionary list is searched from bottom to top. The first match that
|
||||
satisfies any conditions is used (i.e. the one lowest down the list). So
|
||||
if we have:
|
||||
|
||||
~~~~ {.western}
|
||||
```
|
||||
to t@ // unstressed version
|
||||
to tu: $atend // stressed version
|
||||
~~~~
|
||||
```
|
||||
|
||||
then if "to" is at the end of the clause, we get [tu:], if not then we
|
||||
get [t@].
|
||||
|
||||
#### 4.4.4 Translating a Word to another Word {.western}
|
||||
### Translating a Word to another Word
|
||||
|
||||
Rather than specifying the pronunciation of a word by a phoneme string,
|
||||
you can specify another "sounds like" word.
|
||||
|
||||
Use the attribute **\$text** eg.
|
||||
|
||||
~~~~ {.western style="margin-bottom: 0.5cm"}
|
||||
```
|
||||
cough coff $text
|
||||
~~~~
|
||||
```
|
||||
|
||||
Alternatively, use the command **\$textmode** on a line by itself to
|
||||
turn this on for all subsequent entries in the file, until it's turned
|
||||
off by **\$phonememode**. eg.
|
||||
|
||||
~~~~ {.western}
|
||||
```
|
||||
$textmode
|
||||
cough coff
|
||||
through threw
|
||||
$phonememode
|
||||
~~~~
|
||||
```
|
||||
|
||||
This feature cannot be used for the special entries in the **\_list**
|
||||
files which start with an underscore, such as numbers.
|
||||
@@ -554,7 +615,7 @@ Currently "textmode" entries are only recognized for complete words, and
|
||||
not for for stems from which a prefix or suffix has been removed (eg.
|
||||
the word "coughs" would not match the example above).
|
||||
|
||||
### 4.5 Conditional Rules {.western}
|
||||
## Conditional Rules
|
||||
|
||||
Rules in a **\_rules** file and entries in a **\_list** file can be made
|
||||
conditional. They apply only to some voices. This can be useful to
|
||||
@@ -569,14 +630,14 @@ line in the [voice file](voices.html).
|
||||
If the rule starts with **?!** then the rule only applies if the
|
||||
condition number is **not** specified in the voice file. eg.
|
||||
|
||||
~~~~ {.western}
|
||||
```
|
||||
?3 can't kant // only use this if the voice has: dictrules 3
|
||||
?!3 rather rA:D3 // only use if the voice doesn't have: dictrules 3
|
||||
~~~~
|
||||
```
|
||||
|
||||
### 4.6 Numbers and Character Names {.western}
|
||||
## Numbers and Character Names
|
||||
|
||||
#### 4.6.1 Letter names {.western}
|
||||
### Letter names
|
||||
|
||||
The names of individual letters can be given either in the **\_rules**
|
||||
or **\_list** file. Sometimes an individual letter is also used as a
|
||||
@@ -585,14 +646,14 @@ letter name. If so, it should be listed in the **\_list** file, preceded
|
||||
by an underscore, to give the letter name (as distinct from its
|
||||
pronunciation as a word). eg. in English:
|
||||
|
||||
~~~~ {.western style="margin-bottom: 0.5cm"}
|
||||
```
|
||||
_a eI
|
||||
~~~~
|
||||
```
|
||||
|
||||
#### 4.6.2 Numbers {.western}
|
||||
### Numbers
|
||||
|
||||
The operation the TranslateNumber() function is controlled by the
|
||||
language's `langopts.numbers`{.western} option. This constructs spoken
|
||||
language's `langopts.numbers` option. This constructs spoken
|
||||
numbers from fragments according to various options which can be set for
|
||||
each language. The number fragments are given in the **\_list** file.
|
||||
|
||||
@@ -636,7 +697,7 @@ each language. The number fragments are given in the **\_list** file.
|
||||
| | point. |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
|
||||
### 4.7 Character Substitution {.western}
|
||||
## Character Substitution
|
||||
|
||||
Character substitutions can be specified by using a **.replace**section
|
||||
at the start of the **\_rules**file. Each line specified either one or
|
||||
@@ -645,11 +706,11 @@ alphabetic characters. This substitution is done to a word before it is
|
||||
translated using the spelling-to-phoneme rules. Only the lower-case
|
||||
version of the characters needs to be specified. eg.
|
||||
|
||||
```
|
||||
.replace\
|
||||
ô ő // (Hungarian) allow the use of o-circumflex instead of
|
||||
o-double-accute\
|
||||
ô ő // (Hungarian) allow the use of o-circumflex instead of o-double-accute
|
||||
û ű
|
||||
|
||||
cx ĉ // (Esperanto) allow "cx" as an alternative to c-circumflex
|
||||
|
||||
fi fi // replace a single character ligature by two characters
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user