sisyo 1.7.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/LICENSE +16 -16
  2. package/README.md +177 -166
  3. package/bin/known-hashes.json +8 -1
  4. package/bin/sisyo.js +285 -285
  5. package/package.json +30 -30
  6. package/templates/.claude/rules/agents-and-tests.md +32 -24
  7. package/templates/.claude/rules/docs.md +39 -19
  8. package/templates/.claude/skills/fastapi-best-practices/ASYNC-PATTERNS.md +121 -121
  9. package/templates/.claude/skills/fastapi-best-practices/DATABASE.md +153 -153
  10. package/templates/.claude/skills/fastapi-best-practices/DEPENDENCIES.md +140 -140
  11. package/templates/.claude/skills/fastapi-best-practices/PROJECT-STRUCTURE.md +90 -90
  12. package/templates/.claude/skills/fastapi-best-practices/PYDANTIC-GUIDE.md +155 -155
  13. package/templates/.claude/skills/fastapi-best-practices/SKILL.md +123 -123
  14. package/templates/.claude/skills/g6-style/SKILL.md +125 -125
  15. package/templates/.claude/skills/g6-style/references/checks.md +58 -58
  16. package/templates/.claude/skills/g6-style/references/imagery.md +103 -103
  17. package/templates/.claude/skills/g6-style/references/motion.md +121 -121
  18. package/templates/.claude/skills/g6-style/references/sections.md +263 -263
  19. package/templates/.claude/skills/g6-style/references/tokens.md +197 -197
  20. package/templates/.claude/skills/hindsight/SKILL.md +175 -175
  21. package/templates/.claude/skills/hoang-auth/SKILL.md +188 -0
  22. package/templates/.claude/skills/html-docs/SKILL.md +207 -207
  23. package/templates/.claude/skills/i18n-multilang/SKILL.md +153 -153
  24. package/templates/.claude/skills/i18n-multilang/assets/languages.json +47 -47
  25. package/templates/.claude/skills/i18n-multilang/assets/plural-vectors.json +46 -46
  26. package/templates/.claude/skills/i18n-multilang/assets/project/README.md +17 -17
  27. package/templates/.claude/skills/i18n-multilang/assets/project/gitattributes.txt +6 -6
  28. package/templates/.claude/skills/i18n-multilang/assets/project/gitignore.txt +4 -4
  29. package/templates/.claude/skills/i18n-multilang/assets/project/glossary.json +6 -6
  30. package/templates/.claude/skills/i18n-multilang/assets/project/i18n.config.json +22 -22
  31. package/templates/.claude/skills/i18n-multilang/assets/project/locales/__source__/common.json +10 -10
  32. package/templates/.claude/skills/i18n-multilang/assets/project/notes/common.json +5 -5
  33. package/templates/.claude/skills/i18n-multilang/assets/project/style.md +20 -20
  34. package/templates/.claude/skills/i18n-multilang/references/format.md +100 -100
  35. package/templates/.claude/skills/i18n-multilang/references/languages.md +97 -97
  36. package/templates/.claude/skills/i18n-multilang/references/layout-and-versioning.md +256 -256
  37. package/templates/.claude/skills/i18n-multilang/references/numbers.md +161 -161
  38. package/templates/.claude/skills/i18n-multilang/references/platform-unity.md +142 -142
  39. package/templates/.claude/skills/i18n-multilang/references/platform-web.md +107 -107
  40. package/templates/.claude/skills/i18n-multilang/references/translation.md +143 -143
  41. package/templates/.claude/skills/i18n-multilang/references/voice.md +271 -271
  42. package/templates/.claude/skills/i18n-multilang/scripts/i18n.py +1041 -1041
  43. package/templates/.claude/skills/i18n-multilang/scripts/numwords.py +1013 -1013
  44. package/templates/.claude/skills/i18n-multilang/scripts/voice.py +478 -478
  45. package/templates/.claude/skills/neon-game-ui-ux-skill/COMPONENTS.md +490 -490
  46. package/templates/.claude/skills/neon-game-ui-ux-skill/GAMIFICATION.md +246 -246
  47. package/templates/.claude/skills/neon-game-ui-ux-skill/ICONS.md +249 -249
  48. package/templates/.claude/skills/neon-game-ui-ux-skill/LAYOUT-NAV.md +362 -362
  49. package/templates/.claude/skills/neon-game-ui-ux-skill/MOTION-A11Y.md +168 -168
  50. package/templates/.claude/skills/neon-game-ui-ux-skill/SKILL.md +137 -137
  51. package/templates/.claude/skills/neon-game-ui-ux-skill/TOKENS.md +323 -323
  52. package/templates/.claude/skills/react-page-oriented/SKILL.md +407 -407
  53. package/templates/.claude/skills/react-page-oriented/triggers.md +12 -12
  54. package/templates/.claude/skills/terraform-best-practices/SKILL.md +341 -341
  55. package/templates/.claude/skills/typesafe-jev/SKILL.md +148 -148
  56. package/templates/.claude/skills/vibe-docs/SKILL.md +139 -242
  57. package/templates/SISYO.md +39 -37
  58. package/templates/docs/99_progress/features.md +7 -7
  59. package/templates/docs/99_progress/handoff.md +19 -19
  60. package/templates/docs/99_progress/todo.md +15 -15
  61. package/templates/docs/MAP.md +26 -26
@@ -1,161 +1,161 @@
1
- # Numbers in voice
2
-
3
- > A typical report: "1234" is read "một, hai trăm ba mươi bốn" when it must be "một nghìn hai trăm ba mươi bốn";
4
- > "105" must be "một trăm linh năm" or "một trăm lẻ năm", never "một trăm năm". Every language has its own version
5
- > of this.
6
-
7
- ## Why it goes wrong
8
-
9
- A TTS model reads characters, not quantities. Given `1234`, `1 234` or `1.234` it guesses, and the guess depends on
10
- the language, the separator and the words around it. Even with the right words it can swallow the small ones when it
11
- speaks fast (one cloned voice was measured saying 1234 at 9.2 syllables/s and dropping "nghìn", "trăm", "mươi").
12
-
13
- So there are two rules, one before the voice and one after:
14
-
15
- 1. **The text sent to the voice never contains a digit.** Every number is written out in words by a deterministic
16
- tool, in the reading the language really uses.
17
- 2. **Every clip with a number is checked by a recogniser**: the exact number must be heard, whole and in order. A
18
- clip that fails is made again; it is never shipped on trust.
19
-
20
- ## The tool: `scripts/numwords.py`
21
-
22
- ```bash
23
- python numwords.py spell 1234 --lang vi # một nghìn hai trăm ba mươi bốn
24
- python numwords.py spell 105 --all # the 10 voice languages
25
- python numwords.py speak --lang vi "Bạn có 1234 sao và 105 xu."
26
- # {"speak": "Bạn có một nghìn hai trăm ba mươi bốn sao và một trăm linh năm xu.", "numbers": [1234, 105], "issues": []}
27
- python numwords.py heard --lang vi --numbers 1234 "bạn có một hai trăm ba mươi bốn sao" # exit 1: 1234 not heard
28
- python numwords.py selftest
29
- ```
30
-
31
- `voice.py plan` calls `speak` for every line, so the `speak` text and the `numbers` list arrive with each line to
32
- synthesise. From Python: `numwords.speak(text, lang, style)`, `numwords.spell(n, lang)`, `numwords.heard(numbers,
33
- transcript, lang)`.
34
-
35
- Range: whole numbers 0 … 999,999,999,999. Also decimals written with the language's own mark (vi `3,5` → "ba phẩy
36
- năm", en `3.5` → "three point five": the digits after the mark one by one), a leading minus, and digit strings with a
37
- leading zero (`007` → "không không bảy").
38
-
39
- ## Readings (what the tool writes)
40
-
41
- | | 105 | 1234 | 1005 | 21 |
42
- |---|---|---|---|---|
43
- | vi | một trăm linh năm | một nghìn hai trăm ba mươi bốn | một nghìn không trăm linh năm | hai mươi mốt |
44
- | en | one hundred five | one thousand two hundred thirty-four | one thousand five | twenty-one |
45
- | ja | ひゃくご | せんにひゃくさんじゅうよん | せんご | にじゅういち |
46
- | ko | 백오 | 천이백삼십사 | 천오 | 이십일 |
47
- | zh-Hans | 一百零五 | 一千二百三十四 | 一千零五 | 二十一 |
48
- | es | ciento cinco | mil doscientos treinta y cuatro | mil cinco | veintiuno |
49
- | pt-BR | cento e cinco | mil duzentos e trinta e quatro | mil e cinco | vinte e um |
50
- | de | einhundertfünf | eintausendzweihundertvierunddreißig | eintausendfünf | einundzwanzig |
51
- | fr | cent cinq | mille deux cent trente-quatre | mille cinq | vingt et un |
52
- | id | seratus lima | seribu dua ratus tiga puluh empat | seribu lima | dua puluh satu |
53
-
54
- ## What each language gets wrong without the rules
55
-
56
- | Language | The traps the tool handles |
57
- |---|---|
58
- | **vi** | the zero tens: 105 "một trăm **linh** năm" (or "**lẻ**"), never "một trăm năm" (= 150); the zero hundreds after a thousand: 1005 "một nghìn **không trăm** linh năm"; 15 "mười **lăm**", 25 "hai mươi **lăm**"; 21 "hai mươi **mốt**"; 10 "mười" but 20 "hai **mươi**" |
59
- | **en** | no "and" by default (US: "one hundred five"); hyphen in 21–99 |
60
- | **ja** | sound changes: 300 さん**び**ゃく, 600 ろ**っぴ**ゃく, 800 は**っぴ**ゃく, 3000 さん**ぜ**ん, 8000 は**っ**せん; 4 よん, 7 なな, 9 きゅう; 10,000 **いち**まん; 10,000,000 いっせんまん. Written in kana so nothing is left to read |
61
- | **ko** | Sino-Korean for plain numbers; 10,000 is 만 (not 일만), 100,000,000 is 일억 |
62
- | **zh-Hans** | 零 for a skipped place: 105 一百**零**五, 1005 一千**零**五; 110 一百**一**十; 10 is 十 but 一十 after a hundred; 2 is 两 before 千 / 万 / 亿 and before a measure word (2个 → 两个) |
63
- | **es** | 100 "cien" but 101 "ciento uno"; 21 "veintiuno" but 21,000 "veinti**ún** mil"; 1,000 "mil" (not "un mil"); 10⁹ "mil millones" |
64
- | **pt-BR** | "e" between hundreds, tens and units, and before the last group when it is under 100 or a round hundred: 1,200 "mil **e** duzentos", 1,234 "mil duzentos e trinta e quatro"; 100 "cem", 105 "cento e cinco"; 10⁹ "um bilhão" |
65
- | **de** | units before tens: 21 "**ein**und**zwanzig**"; "eins" only at the very end (101 "einhunderteins", 1,001 "eintausendeins"); 16 "sechzehn", 17 "siebzehn", 30 "dreißig"; "eine Million" |
66
- | **fr** | 70–99: "soixante-dix", "quatre-vingts", "quatre-vingt-onze"; "et" only in 21, 31 … 61 and 71; "quatre-vingts" and "deux cents" lose the s before another number or "mille" |
67
- | **id** | the se- forms: 10 "sepuluh", 11 "sebelas", 100 "seratus", 1,000 "seribu" (never "satu ribu"); 12–19 "… belas" |
68
-
69
- ## What the tool will not guess: issues
70
-
71
- `speak` returns `issues` when a number's reading depends on something only a person or the author knows. A line with
72
- an issue is `blocked` in `voice.py plan` until it is settled, in this order of preference:
73
-
74
- 1. **Change the shown text** so nothing is left to guess: `1500` instead of `1.500` (the rule for whole numbers below
75
- 10,000 anyway, [format.md](format.md)), words instead of a symbol where the screen allows it.
76
- 2. Otherwise **write the spoken text** with `voice.py say` (next section).
77
-
78
- | Issue | Example | Why it is not guessed |
79
- |---|---|---|
80
- | `ambiguous` | `1.234`, `1,234`, `12.000`, `1 234` | one thousand two hundred thirty-four, or one point two three four, or two numbers? Vietnamese and German group with a dot, English with a comma, French with a space. (Two or more groups, `1.234.567`, and groups split by a no-break space are read as one number.) |
81
- | `symbol` | `50%`, `12:30`, `3/4`, `2+3`, `5°`, `$10` | percent, time, fraction, date, score and sum are read differently in every language |
82
- | `glued` | `A4`, `3D`, `5kg`, `1st`, `x2` | letters and digits together are a name, a unit or an ordinal |
83
- | `counter` | ja `3つ`, `1本`, `2人`; ko `3개`, `5명` | Japanese counters change the reading (みっつ, いっぽん, ふたり); Korean counts things with native numbers (세 개, 다섯 명) but minutes and money with Sino-Korean ones |
84
- | `large` | 10¹² and above | write it |
85
-
86
- Things the tool cannot see at all, to settle when writing a line: years ("2026" as a year is "twenty twenty-six" in
87
- English, "zweitausendsechsundzwanzig" in German), ordinals ("thứ 2", "le 1er", German "3." before a noun), phone
88
- numbers and codes (write them with a leading zero or as words so they are read digit by digit), Spanish and
89
- Portuguese gender agreement (doscient**as** monedas, du**as** estrelas), Roman numerals, and a product's own symbols.
90
- A maths game's operators ("+", "×", "=") are the product's vocabulary: the product's voice tool maps them to words
91
- before `speak` sees the text.
92
-
93
- ## Writing the spoken text by hand: `voice.py say`
94
-
95
- ```bash
96
- python voice.py say --lang ja --id game:say.reward "ほしを せんごひゃっこと コインを ひゃくごまい もらったよ!"
97
- python voice.py say --lang vi --id shop:say.sale "Giảm năm mươi phần trăm hôm nay"
98
- ```
99
-
100
- It writes the override into `i18n/voice/speak/<lang>.json`:
101
-
102
- ```json
103
- { "game:say.reward": { "text": "ほしを 1500こと コインを 105まい もらったよ!", "speak": "ほしを せんごひゃっこと コインを ひゃくごまい もらったよ!" } }
104
- ```
105
-
106
- and from then on the tool holds the override to three rules, so a hand-written reading cannot drift:
107
-
108
- - **It says the numbers the shown text shows.** The numbers are read from the shown text (`1500`, `105`) and each
109
- must be found in the spoken text in one of its accepted readings, counter readings included (ひゃっこ, みっつ,
110
- 세 개). "Giảm năm phần trăm" for a text that shows `50%` is refused. The same list goes with the line to the check
111
- after synthesis.
112
- - **It contains no digit.**
113
- - **It belongs to one shown text.** `text` records the sentence it was written for. When that sentence changes (the
114
- reward becomes 2000), the line is `blocked` again until the spoken text is rewritten: an old reading never
115
- survives a changed number.
116
-
117
- For a draft, `numwords.py speak --lenient --lang vi "…1.500…"` prints the text with grouped numbers read by the
118
- language's own convention. It never invents a reading for symbols or counters. If a correct reading is one the tool
119
- does not know (a year said as "twenty twenty-six", a product name with a number), pass `--numbers` with the numbers
120
- the spoken text really says (`--numbers ""` for none) and note why in the commit.
121
-
122
- ## Style choices (per project, in `i18n.config.json` → `voice.numberStyle`)
123
-
124
- | Language | Option | Default | Other |
125
- |---|---|---|---|
126
- | vi | `linh` | `linh` (một trăm linh năm) | `lẻ` (một trăm lẻ năm) |
127
- | vi | `four` | `bốn` (ba mươi bốn) | `tư` (ba mươi tư) |
128
- | vi | `thousand` | `nghìn` | `ngàn` |
129
- | en | `and_` | `false` (one hundred five) | `true` (one hundred and five) |
130
- | ja | `zero` | `ゼロ` | `れい` |
131
- | zh-Hans | `liang` | `true` (两千) | `false` (二千) |
132
-
133
- Both readings in each pair are correct, and the check after synthesis accepts both. What matters is one style per
134
- product per language: a child must not hear "linh" in one question and "lẻ" in the next.
135
-
136
- ## After synthesis: was the number said?
137
-
138
- `numwords.heard(numbers, transcript, lang)` takes the `numbers` list that came with the line and what a recogniser
139
- wrote, and answers whether each number stands in the transcript whole and in order. It accepts the usual spoken
140
- variants (linh / lẻ, bốn / tư, nghìn / ngàn, with or without "and", kana or kanji, 两 or 二, the readings before a
141
- counter or a feminine noun: ひゃっこ, みっつ, 세 개, una, duas, une) and digits ("1.234", "1,234"). In the languages
142
- written with spaces it rejects a match that is part of a longer number: 234 inside "một nghìn hai trăm ba mươi
143
- bốn", "one hundred" inside "one hundred five" or "one hundred and five". A number after an ordinary "and / y / e /
144
- et" ("stars and one hundred five coins") is its own number.
145
-
146
- This is the floor for every product. It catches a swallowed "nghìn", swapped or missing numbers
147
- and wrong order. It does not judge pronunciation, accent or pace, and in Japanese, Korean, Chinese and German (no
148
- spaces between number words) it only checks that the reading is present, so small numbers are weakly checked there.
149
- A product with many numbers adds its own gates. Gates that have proved their worth: two recognisers for Vietnamese,
150
- exact kana comparison for Japanese, a pace limit for numbers (6.5 syllables/s for vi and en, 10 morae/s for ja),
151
- pause and voice-quality checks.
152
-
153
- A number that keeps failing after three takes at a slower speed is a line to rewrite (split the sentence, move the
154
- number to the end), not a clip to accept.
155
-
156
- ## Building numbers from pieces
157
-
158
- A game that speaks arbitrary numbers at runtime (a maths game's questions) cannot record every number. Compose them from
159
- recorded pieces **with the same reading rules** as this tool (the game's number composer and `numwords` must agree: a
160
- test spells 0–9999 with both and compares), cut the pieces from carrier sentences so they sound connected, and run the
161
- `heard` check on assembled samples, not only on the pieces.
1
+ # Numbers in voice
2
+
3
+ > A typical report: "1234" is read "một, hai trăm ba mươi bốn" when it must be "một nghìn hai trăm ba mươi bốn";
4
+ > "105" must be "một trăm linh năm" or "một trăm lẻ năm", never "một trăm năm". Every language has its own version
5
+ > of this.
6
+
7
+ ## Why it goes wrong
8
+
9
+ A TTS model reads characters, not quantities. Given `1234`, `1 234` or `1.234` it guesses, and the guess depends on
10
+ the language, the separator and the words around it. Even with the right words it can swallow the small ones when it
11
+ speaks fast (one cloned voice was measured saying 1234 at 9.2 syllables/s and dropping "nghìn", "trăm", "mươi").
12
+
13
+ So there are two rules, one before the voice and one after:
14
+
15
+ 1. **The text sent to the voice never contains a digit.** Every number is written out in words by a deterministic
16
+ tool, in the reading the language really uses.
17
+ 2. **Every clip with a number is checked by a recogniser**: the exact number must be heard, whole and in order. A
18
+ clip that fails is made again; it is never shipped on trust.
19
+
20
+ ## The tool: `scripts/numwords.py`
21
+
22
+ ```bash
23
+ python numwords.py spell 1234 --lang vi # một nghìn hai trăm ba mươi bốn
24
+ python numwords.py spell 105 --all # the 10 voice languages
25
+ python numwords.py speak --lang vi "Bạn có 1234 sao và 105 xu."
26
+ # {"speak": "Bạn có một nghìn hai trăm ba mươi bốn sao và một trăm linh năm xu.", "numbers": [1234, 105], "issues": []}
27
+ python numwords.py heard --lang vi --numbers 1234 "bạn có một hai trăm ba mươi bốn sao" # exit 1: 1234 not heard
28
+ python numwords.py selftest
29
+ ```
30
+
31
+ `voice.py plan` calls `speak` for every line, so the `speak` text and the `numbers` list arrive with each line to
32
+ synthesise. From Python: `numwords.speak(text, lang, style)`, `numwords.spell(n, lang)`, `numwords.heard(numbers,
33
+ transcript, lang)`.
34
+
35
+ Range: whole numbers 0 … 999,999,999,999. Also decimals written with the language's own mark (vi `3,5` → "ba phẩy
36
+ năm", en `3.5` → "three point five": the digits after the mark one by one), a leading minus, and digit strings with a
37
+ leading zero (`007` → "không không bảy").
38
+
39
+ ## Readings (what the tool writes)
40
+
41
+ | | 105 | 1234 | 1005 | 21 |
42
+ |---|---|---|---|---|
43
+ | vi | một trăm linh năm | một nghìn hai trăm ba mươi bốn | một nghìn không trăm linh năm | hai mươi mốt |
44
+ | en | one hundred five | one thousand two hundred thirty-four | one thousand five | twenty-one |
45
+ | ja | ひゃくご | せんにひゃくさんじゅうよん | せんご | にじゅういち |
46
+ | ko | 백오 | 천이백삼십사 | 천오 | 이십일 |
47
+ | zh-Hans | 一百零五 | 一千二百三十四 | 一千零五 | 二十一 |
48
+ | es | ciento cinco | mil doscientos treinta y cuatro | mil cinco | veintiuno |
49
+ | pt-BR | cento e cinco | mil duzentos e trinta e quatro | mil e cinco | vinte e um |
50
+ | de | einhundertfünf | eintausendzweihundertvierunddreißig | eintausendfünf | einundzwanzig |
51
+ | fr | cent cinq | mille deux cent trente-quatre | mille cinq | vingt et un |
52
+ | id | seratus lima | seribu dua ratus tiga puluh empat | seribu lima | dua puluh satu |
53
+
54
+ ## What each language gets wrong without the rules
55
+
56
+ | Language | The traps the tool handles |
57
+ |---|---|
58
+ | **vi** | the zero tens: 105 "một trăm **linh** năm" (or "**lẻ**"), never "một trăm năm" (= 150); the zero hundreds after a thousand: 1005 "một nghìn **không trăm** linh năm"; 15 "mười **lăm**", 25 "hai mươi **lăm**"; 21 "hai mươi **mốt**"; 10 "mười" but 20 "hai **mươi**" |
59
+ | **en** | no "and" by default (US: "one hundred five"); hyphen in 21–99 |
60
+ | **ja** | sound changes: 300 さん**び**ゃく, 600 ろ**っぴ**ゃく, 800 は**っぴ**ゃく, 3000 さん**ぜ**ん, 8000 は**っ**せん; 4 よん, 7 なな, 9 きゅう; 10,000 **いち**まん; 10,000,000 いっせんまん. Written in kana so nothing is left to read |
61
+ | **ko** | Sino-Korean for plain numbers; 10,000 is 만 (not 일만), 100,000,000 is 일억 |
62
+ | **zh-Hans** | 零 for a skipped place: 105 一百**零**五, 1005 一千**零**五; 110 一百**一**十; 10 is 十 but 一十 after a hundred; 2 is 两 before 千 / 万 / 亿 and before a measure word (2个 → 两个) |
63
+ | **es** | 100 "cien" but 101 "ciento uno"; 21 "veintiuno" but 21,000 "veinti**ún** mil"; 1,000 "mil" (not "un mil"); 10⁹ "mil millones" |
64
+ | **pt-BR** | "e" between hundreds, tens and units, and before the last group when it is under 100 or a round hundred: 1,200 "mil **e** duzentos", 1,234 "mil duzentos e trinta e quatro"; 100 "cem", 105 "cento e cinco"; 10⁹ "um bilhão" |
65
+ | **de** | units before tens: 21 "**ein**und**zwanzig**"; "eins" only at the very end (101 "einhunderteins", 1,001 "eintausendeins"); 16 "sechzehn", 17 "siebzehn", 30 "dreißig"; "eine Million" |
66
+ | **fr** | 70–99: "soixante-dix", "quatre-vingts", "quatre-vingt-onze"; "et" only in 21, 31 … 61 and 71; "quatre-vingts" and "deux cents" lose the s before another number or "mille" |
67
+ | **id** | the se- forms: 10 "sepuluh", 11 "sebelas", 100 "seratus", 1,000 "seribu" (never "satu ribu"); 12–19 "… belas" |
68
+
69
+ ## What the tool will not guess: issues
70
+
71
+ `speak` returns `issues` when a number's reading depends on something only a person or the author knows. A line with
72
+ an issue is `blocked` in `voice.py plan` until it is settled, in this order of preference:
73
+
74
+ 1. **Change the shown text** so nothing is left to guess: `1500` instead of `1.500` (the rule for whole numbers below
75
+ 10,000 anyway, [format.md](format.md)), words instead of a symbol where the screen allows it.
76
+ 2. Otherwise **write the spoken text** with `voice.py say` (next section).
77
+
78
+ | Issue | Example | Why it is not guessed |
79
+ |---|---|---|
80
+ | `ambiguous` | `1.234`, `1,234`, `12.000`, `1 234` | one thousand two hundred thirty-four, or one point two three four, or two numbers? Vietnamese and German group with a dot, English with a comma, French with a space. (Two or more groups, `1.234.567`, and groups split by a no-break space are read as one number.) |
81
+ | `symbol` | `50%`, `12:30`, `3/4`, `2+3`, `5°`, `$10` | percent, time, fraction, date, score and sum are read differently in every language |
82
+ | `glued` | `A4`, `3D`, `5kg`, `1st`, `x2` | letters and digits together are a name, a unit or an ordinal |
83
+ | `counter` | ja `3つ`, `1本`, `2人`; ko `3개`, `5명` | Japanese counters change the reading (みっつ, いっぽん, ふたり); Korean counts things with native numbers (세 개, 다섯 명) but minutes and money with Sino-Korean ones |
84
+ | `large` | 10¹² and above | write it |
85
+
86
+ Things the tool cannot see at all, to settle when writing a line: years ("2026" as a year is "twenty twenty-six" in
87
+ English, "zweitausendsechsundzwanzig" in German), ordinals ("thứ 2", "le 1er", German "3." before a noun), phone
88
+ numbers and codes (write them with a leading zero or as words so they are read digit by digit), Spanish and
89
+ Portuguese gender agreement (doscient**as** monedas, du**as** estrelas), Roman numerals, and a product's own symbols.
90
+ A maths game's operators ("+", "×", "=") are the product's vocabulary: the product's voice tool maps them to words
91
+ before `speak` sees the text.
92
+
93
+ ## Writing the spoken text by hand: `voice.py say`
94
+
95
+ ```bash
96
+ python voice.py say --lang ja --id game:say.reward "ほしを せんごひゃっこと コインを ひゃくごまい もらったよ!"
97
+ python voice.py say --lang vi --id shop:say.sale "Giảm năm mươi phần trăm hôm nay"
98
+ ```
99
+
100
+ It writes the override into `i18n/voice/speak/<lang>.json`:
101
+
102
+ ```json
103
+ { "game:say.reward": { "text": "ほしを 1500こと コインを 105まい もらったよ!", "speak": "ほしを せんごひゃっこと コインを ひゃくごまい もらったよ!" } }
104
+ ```
105
+
106
+ and from then on the tool holds the override to three rules, so a hand-written reading cannot drift:
107
+
108
+ - **It says the numbers the shown text shows.** The numbers are read from the shown text (`1500`, `105`) and each
109
+ must be found in the spoken text in one of its accepted readings, counter readings included (ひゃっこ, みっつ,
110
+ 세 개). "Giảm năm phần trăm" for a text that shows `50%` is refused. The same list goes with the line to the check
111
+ after synthesis.
112
+ - **It contains no digit.**
113
+ - **It belongs to one shown text.** `text` records the sentence it was written for. When that sentence changes (the
114
+ reward becomes 2000), the line is `blocked` again until the spoken text is rewritten: an old reading never
115
+ survives a changed number.
116
+
117
+ For a draft, `numwords.py speak --lenient --lang vi "…1.500…"` prints the text with grouped numbers read by the
118
+ language's own convention. It never invents a reading for symbols or counters. If a correct reading is one the tool
119
+ does not know (a year said as "twenty twenty-six", a product name with a number), pass `--numbers` with the numbers
120
+ the spoken text really says (`--numbers ""` for none) and note why in the commit.
121
+
122
+ ## Style choices (per project, in `i18n.config.json` → `voice.numberStyle`)
123
+
124
+ | Language | Option | Default | Other |
125
+ |---|---|---|---|
126
+ | vi | `linh` | `linh` (một trăm linh năm) | `lẻ` (một trăm lẻ năm) |
127
+ | vi | `four` | `bốn` (ba mươi bốn) | `tư` (ba mươi tư) |
128
+ | vi | `thousand` | `nghìn` | `ngàn` |
129
+ | en | `and_` | `false` (one hundred five) | `true` (one hundred and five) |
130
+ | ja | `zero` | `ゼロ` | `れい` |
131
+ | zh-Hans | `liang` | `true` (两千) | `false` (二千) |
132
+
133
+ Both readings in each pair are correct, and the check after synthesis accepts both. What matters is one style per
134
+ product per language: a child must not hear "linh" in one question and "lẻ" in the next.
135
+
136
+ ## After synthesis: was the number said?
137
+
138
+ `numwords.heard(numbers, transcript, lang)` takes the `numbers` list that came with the line and what a recogniser
139
+ wrote, and answers whether each number stands in the transcript whole and in order. It accepts the usual spoken
140
+ variants (linh / lẻ, bốn / tư, nghìn / ngàn, with or without "and", kana or kanji, 两 or 二, the readings before a
141
+ counter or a feminine noun: ひゃっこ, みっつ, 세 개, una, duas, une) and digits ("1.234", "1,234"). In the languages
142
+ written with spaces it rejects a match that is part of a longer number: 234 inside "một nghìn hai trăm ba mươi
143
+ bốn", "one hundred" inside "one hundred five" or "one hundred and five". A number after an ordinary "and / y / e /
144
+ et" ("stars and one hundred five coins") is its own number.
145
+
146
+ This is the floor for every product. It catches a swallowed "nghìn", swapped or missing numbers
147
+ and wrong order. It does not judge pronunciation, accent or pace, and in Japanese, Korean, Chinese and German (no
148
+ spaces between number words) it only checks that the reading is present, so small numbers are weakly checked there.
149
+ A product with many numbers adds its own gates. Gates that have proved their worth: two recognisers for Vietnamese,
150
+ exact kana comparison for Japanese, a pace limit for numbers (6.5 syllables/s for vi and en, 10 morae/s for ja),
151
+ pause and voice-quality checks.
152
+
153
+ A number that keeps failing after three takes at a slower speed is a line to rewrite (split the sentence, move the
154
+ number to the end), not a clip to accept.
155
+
156
+ ## Building numbers from pieces
157
+
158
+ A game that speaks arbitrary numbers at runtime (a maths game's questions) cannot record every number. Compose them from
159
+ recorded pieces **with the same reading rules** as this tool (the game's number composer and `numwords` must agree: a
160
+ test spells 0–9999 with both and compares), cut the pieces from carrier sentences so they sound connected, and run the
161
+ `heard` check on assembled samples, not only on the pieces.