Files
jaacoppi a54824c9e5 voices: Change default number pronunciation rule to enabled.
docs: add details about number flags to the documentation.

It's clearly intended to be enabled by default:
- it's defined as default behaviour translate.h (NUM_DEFAULT)
- tr_languages.c sets many default values related to number processing
  that have no meaning unless langopts.numbers == 1.

It is also a more sensible default since most languages will want to
have number processing on. This makes adding new languages easier
because  adding an entry to tr_languages.c is unnecessary.

A negative side effect is that languages with partial number defines
might experience bugs when reading undefined numbers. This is a bug and
should be fixed.

This will have the side effect of enabling number processing for
languages that currently have it disabled. However, there shouldn't be
any.

Here's a way to check affected languages:
for voice in $(ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH}
src/espeak-ng --voices | grep -v Languages | awk '{print $2}'); do
OUTPUT=$(ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH}
src/espeak-ng -qx -v $voice "1 - 2 - 3 - 12 - 123") && echo "$voice:
$OUTPUT" ; done

These voices clearly benefit from enabling numbers (they already have
number rules in *_list):
ba, cmn (zh), hak, haw, ja, kok, nb, nci

Some languages are missing some definitions (like _12) in _list files.
It causes the program to skip some numbers.
Numbering needs to be turned off explicitly for:
jbo, mi, my, piqd, py, qu, quc, th, uz

Languages with no number rules at all:
chr, cv, he, nog, tk, ug
2021-03-04 19:13:09 +02:00

1.1 KiB

Numbers

Language Options

The following properties in tr_languages.c control how numbers behave for a language:

tr->langopts.numbers
tr->langopts.numbers2

These controls how numbers are pronounced.

If numbers is set to 0, numbers will not be pronounced. Setting it to 1 (the default value) will enable number pronunciation using the dictionary rules. For more control over number pronunciation, see the flags in translate.h.

tr->langopts.max_digits

This is the maximum number of digits that can be spoken by the language. If the number of digits is larger than this, the number is spoken digit by digit.

tr->langopts.break_numbers

This controls how digits are grouped for speaking large numbers. The default is to group into 3 digit groups (thousand, million, billion, trillion, etc.).

tr->langopts.thousands_sep

The character used to separate digit groups. The default is ,.

tr->langopts.decimal_sep

The character used to separate the integer and decimal parts of a real number. The default is ..