@kensio/pinyinjs 1.2.1 → 1.2.2

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.
package/CHANGELOG.md CHANGED
@@ -11,6 +11,15 @@ which a dictionary rebuild can change, and the artifact format under `data/`.
11
11
 
12
12
  ### Added
13
13
 
14
+ - **`TEACHING_JIAO` and `COUNTED_MEASURE`,** two more lattice rules, and
15
+ `QUANTITY_CHARACTERS`, the 汉字 a quantity is written with that the second of
16
+ them asks about. See the fixes below for what they do and what they measure.
17
+ - **`counts` on the numeral options.** Whether the number stands immediately in
18
+ front of something it counts, which is what makes a lone 2 两:
19
+ `numeralHanzi(2, { counts: true })` is `两` and `numeralHanzi(2)` is `二`.
20
+ Unlike `liang` it is not a variable choice — 二个 is simply wrong — but
21
+ nothing about the number says whether it is counting, so the caller says.
22
+ `convert` sets it from the character after the digits.
14
23
  - **`SYLLABLE_TONES` and `isAttestedTone`.** Which tones each of the 424
15
24
  syllables is actually written in, extracted from the merged dictionary and
16
25
  held to it by a build assertion. 424 syllables in five tones would be 2,120
@@ -24,14 +33,63 @@ which a dictionary rebuild can change, and the artifact format under `data/`.
24
33
  en.wiktionary's Mandarin pronunciation blocks, in bopomofo, Wade-Giles, Yale
25
34
  and GR with their tones, and all 50 rows of Wikipedia's _Help:IPA/Mandarin_
26
35
  key. The 417-row syllabary already checked was toneless, so it could say
27
- nothing about tone marks, the neutral tone, 儿化 or how a word is joined —
36
+ nothing about tone marks, the neutral tone, 儿化 or how a word is joined,
28
37
  which is where the four fixes below were found.
29
38
 
30
39
  ### Fixed
31
40
 
41
+ - **教 was `jiào` even where it was teaching.** 他在北京大学教了三年书 came out
42
+ `jiàole sān nián shū`, and 我教英语, 谁教你法语 and 她教我如何游泳 with it.
43
+ The dictionary stores 教 as `jiào` with `jiāo` as an alternate, and `jiào` is
44
+ right for the compounds — 教育, 教师, 宗教, 主教 — which are words and reach
45
+ their reading through the word; what is left is the 教 standing as a word of
46
+ its own, and that one is the verb. The object is what says so: a pronoun, a
47
+ noun or a name after it, or an aspect particle, since only a verb takes 了,
48
+ 过 or 得. Forcing the character's own reading was not enough on its own,
49
+ because a two-character reading carries its 教 into the position from
50
+ outside — 王老师教我们汉语 read `jiào` off 师教 and 来教我 off 来教 — so an
51
+ untagged pair ending in 教 goes too, while every tagged word keeps its
52
+ reading: 任教, 宗教, 主教, 佛教, 传教, 执教, 请教, 家教. Over 88,866 lines
53
+ 181 教 decode as a word of their own and every one read `jiào`; 158 are now
54
+ `jiāo`, three of them wrongly — 统一教创始人, 方法教深思 and 做到了教政分离,
55
+ where a nominal compound takes an object's shape. CPP's polyphone score is
56
+ 89.05%, up from 89.04%.
57
+ - **A 量词 was swallowed by the word behind it.** 三个人 was `sān gèrén`, three
58
+ _personals_, because 个人 is a common noun and nothing weighed it against the
59
+ 个 belonging to the 三 in front of it. It is now `sān gè rén`, and so are
60
+ 两家人, 三杯水, 四匹马, 十八层楼 and 一段长时间. What makes it decidable is
61
+ that the dictionary tags the 量词: 个, 次, 天 and 杯 are `q`, while the
62
+ characters that only look like measure words in this position are not — 分 is
63
+ a verb, 部 and 成 are nouns, 年 and 点 are numerals — so 五分钟, 三部分,
64
+ 五成分, 五年级 and 三点钟 are untouched, and those are exactly the words a
65
+ blanket rule would break. Nor does an ordinal count anything (第三集团军), nor
66
+ a numeral inside a longer word (唯一道路), and a number and its measure
67
+ written solid survive whole where the dictionary has them: 一辈子, 一会儿,
68
+ 一口气 and 两口子 are unchanged. Over 88,866 lines the rule forbids 561 edges
69
+ and moves 53 decodes, three of them wrongly — 一批评, 这一名词 and 六七股灾,
70
+ where the 一 and the 六七 count nothing. Exactly one reading changes in the
71
+ whole corpus and it is a fix: 已经下了两天雨了 read 天雨 as `tiān yù`.
72
+ - **The Han after a number was decoded without it.** 2个人 was `liǎng gèrén`
73
+ while 两个人 written out was already `liǎng gè rén`, because a Han run was
74
+ decoded on its own and had no idea a number preceded it. A run is now decoded
75
+ with the 汉字 the digits stand for in front of it, and reported without them,
76
+ so digits and 汉字 reach the same decode. `decodeRun` and `decodeRunScored`
77
+ take that context as a fourth argument; where a reading would straddle the
78
+ join — 1点儿事, whose 一点儿 is one `yìdiǎnr` over both sides of it — the run
79
+ is decoded alone, as before.
80
+ - **A lone 2 in front of a 量词 was read 二.** 我们买了2个西瓜 came out as
81
+ `wǒmen mǎile èr gè xīguā`, and a 2 standing immediately in front of what it
82
+ counts is 两: it is now `liǎng gè`, and 2岁 is `liǎng suì`, 2点 `liǎng diǎn`
83
+ and 2万人 `liǎng wàn rén`, the same 两 that 2,000 and 2:00 already got. The
84
+ measure words a 2 can count with are an open list, so 两 is the default and
85
+ the exceptions are named — 月, 日, 号, 楼, 路, 班 and 期, where the digit
86
+ labels a position rather than counting (2月 is `èr yuè`), an ordinal, which
87
+ the 第 in front of it marks (第2次 is `dì èr cì`), and 十 and 百, which follow
88
+ 二 as 20 and 200 already do. A 2 inside a larger number is untouched: 12个 is
89
+ still `shí'èr gè`.
32
90
  - **A decimal lost the grouping of its counted part.** 一共75.5元 was
33
91
  `yígòng qī shí wǔ diǎn wǔ yuán`, with the 75 in loose syllables, and is now
34
- `yígòng qīshíwǔ diǎn wǔ yuán` — the same word 一共75元 already got. Only what
92
+ `yígòng qīshíwǔ diǎn wǔ yuán`, the same word 一共75元 already got. Only what
35
93
  follows the 点 is read a digit at a time, and that part is unchanged: 3.14 is
36
94
  still `sān diǎn yī sì`, and sandhi still stops at the point.
37
95
  - **A decimal point was read as a full stop.** 一共75.5元 came back as
@@ -42,14 +100,14 @@ which a dictionary rebuild can change, and the artifact format under `data/`.
42
100
  is now `ㄋㄚˇㄦ`: the mark belongs to the nucleus and the suffix is not part of
43
101
  what it marks. A mark written after the ㄦ is still read.
44
102
  - **Wade-Giles put the tone digit on the 儿化 suffix,** so 花儿 huār was
45
- `hua-êrh¹` — a first-tone 兒. It is now `hua¹-'rh`, with the digit on the
103
+ `hua-êrh¹`, a first-tone 兒. It is now `hua¹-'rh`, with the digit on the
46
104
  syllable the tone belongs to and the suffix written as the reduced `'rh` that
47
105
  keeps it apart from 女儿 nǚ'ér's `nü³-êrh²`.
48
106
  - **Gwoyeu Romatzyh wrote 儿化 as a plain `-l` suffix.** GR fuses it into the
49
107
  rime instead, and the rules are now implemented as _Spelling in Gwoyeu
50
108
  Romatzyh_ gives them: 玩儿 wánr is `wal` rather than `wanl`, 事儿 shìr is
51
109
  `shell`, 今儿 jīnr is `jiel`. The fusion is many-to-one, so `jiel` is 今儿 and
52
- 鸡儿 both and 128 forms no longer round-trip — every one of them a form the
110
+ 鸡儿 both and 128 forms no longer round-trip, every one of them a form the
53
111
  language does not write.
54
112
  - **Gwoyeu Romatzyh wrote `.mhe` for a neutral 么.** The `-h-` is the first tone
55
113
  of a sonorant initial, and a neutral syllable is in no tone at all; the basic
@@ -58,23 +116,23 @@ which a dictionary rebuild can change, and the artifact format under `data/`.
58
116
  follows the broader IPA column of _Comparison of Standard Chinese
59
117
  transcription systems_, which is where its ground truth comes from; the two
60
118
  pages differ at the medials, -ang, the empty rhyme and the diphthongs. No
61
- output changed — the claim did.
119
+ output changed, only the claim.
62
120
  - **`--system ipa` capitalised the IPA.** 我去银行。他姓王。 came out as
63
121
  `Uo˨˩˦ ... Tʰa˥ ɕiŋ˥˩ Uaŋ˧˥`, with the sentence capital and the proper noun
64
122
  carried over from the pinyin as though a transcription spelled words. IPA
65
- letters are symbols rather than an alphabet — `[T]` is not `[t]` in a larger
66
- size but a symbol the IPA does not have — so the capitals are now dropped for
123
+ letters are symbols rather than an alphabet, since `[T]` is not `[t]` in a
124
+ larger size but a symbol the IPA does not have, so the capitals are now dropped for
67
125
  IPA and bopomofo and kept for the three romanisations. `toTranscription`
68
126
  takes `{ capitals: false }` for callers writing their own.
69
127
  - **A compound lost the zh-TW reading its own parts carry.** 垃圾分類 read
70
128
  `lājīfēnlèi` under `zh-TW`, because CC-CEDICT marks `Taiwan pr.` on 垃圾 and
71
- 垃圾桶 and on no other compound, and the decoder prefers the longer word — so
129
+ 垃圾桶 and on no other compound, and the decoder prefers the longer word, so
72
130
  the entry that had the delta was never consulted. 101 compounds now compose
73
131
  one from their constituents, 垃圾 accounting for 14 of them and 比肩, 玳瑁,
74
132
  从容, 骨头, 蜗牛 and 说服 for most of the rest. Three guards keep it honest:
75
133
  the constituent has to survive segmentation (運行狀況 contains 行狀 but reads
76
134
  運行 + 狀況), it has to be read in the compound exactly as its own entry reads
77
- it, and it has to be a whole word — never a bare character, since 會's `huǐ`
135
+ it, and it has to be a whole word rather than a bare character, since 會's `huǐ`
78
136
  would rewrite 三合會 as `sānhéhuǐ` and 3,743 entries would compose that way
79
137
  against the 101 that whole words compose.
80
138
  - **A character's zh-TW delta was often a choice between its 普通话 senses.**
@@ -83,25 +141,25 @@ which a dictionary rebuild can change, and the artifact format under `data/`.
83
141
  is a locale shift: CC-CEDICT lists 地[de5] and 地[di4] as separate entries, so
84
142
  `dì` is what 地 reads in 普通话 when it means the ground, and the adverbial
85
143
  particle is `de` in Taipei too. A delta the word already has as a 普通话 sense
86
- is now refused — 71 characters and 3 words lose one, 都, 着, 应, 差, 称, 斗,
87
- 舍, 薄 and 万 among them — while 和 `hàn`, 期 `qí`, 垃 `lè` and 髮 `fǎ` stay,
144
+ is now refused, so 71 characters and 3 words lose one, 都, 着, 应, 差, 称, 斗,
145
+ 舍, 薄 and 万 among them, while 和 `hàn`, 期 `qí`, 垃 `lè` and 髮 `fǎ` stay,
88
146
  no 普通话 sense reading any of those that way. A `Taiwan pr.` note is also
89
147
  only read off a sense matching the reading the entry settled on, which drops
90
148
  16 more: the note on 著's chess-move sense, which reads `zhāo`, had been
91
149
  giving the aspect particle 着 a 國語 reading of `zhuó`.
92
150
  - **A locale delta overwrote a reading it was not measured against.** The delta
93
151
  describes the entry's own 普通话 reading, so a polyphone the decode read some
94
- other way — 得 forced to the modal `děi` rather than the particle `de` its
95
- entry stores — now keeps what the decode worked out instead of being rewritten
96
- from the entry.
152
+ other way, such as 得 forced to the modal `děi` rather than the particle `de`
153
+ its entry stores, now keeps what the decode worked out instead of being
154
+ rewritten from the entry.
97
155
 
98
156
  ### Changed
99
157
 
100
158
  - **Reading a romanisation narrows on the tone that was written.**
101
159
  `readWadeGiles("lo²")` was `[luó, ló]` and is now `[luó]`: 咯 is a
102
160
  sentence-final particle and is only ever neutral, so ló is not a syllable
103
- Mandarin has. The same goes for `readWadeGilesLoosely` — `pan²` is pán alone
104
- — and for `readYale`, `readIpa` and `readGwoyeu`, where it settles the 儿化
161
+ Mandarin has. The same goes for `readWadeGilesLoosely`, where `pan²` is pán
162
+ alone, and for `readYale`, `readIpa` and `readGwoyeu`, where it settles the 儿化
105
163
  collisions the same way (`ell` is 二 èr, there being no first-tone 兒).
106
164
  Narrowing never empties a list: a tone no candidate is written in leaves the
107
165
  candidates alone, since that says the tone is wrong rather than the spelling.
@@ -123,7 +181,7 @@ decoder internals and the build pipeline.
123
181
  - **Transcription systems, all five, in both directions.** Bopomofo, Wade-Giles,
124
182
  Yale, Gwoyeu Romatzyh and IPA at the syllable level, plus hanzi → any of them
125
183
  end to end via `convert --system` and `convertToWadeGiles`. Checked against
126
- 417 rows of an outside syllabary in every system — 3,336 cells.
184
+ 417 rows of an outside syllabary in every system, which is 3,336 cells.
127
185
  - **Reading ambiguous Wade-Giles.** `readWadeGilesLoosely` allows for the
128
186
  apostrophes and diacritics real texts drop, and `splitWadeGiles` puts back the
129
187
  hyphens they lose. Measured: 52.07% of written syllables lose their identity
@@ -134,7 +192,7 @@ decoder internals and the build pipeline.
134
192
  follows them.
135
193
  - **Orthography rules.** The 重叠 hyphen for AABB and repeated words, the 成语
136
194
  hyphen from a curated list of 117, 老王 → `Lǎo Wáng`, and GB/T 16159 5.1 in
137
- full — 毛泽东 is `Máo Zédōng`, 北京大学 is `Běijīng Dàxué`, on boundaries
195
+ full, so 毛泽东 is `Máo Zédōng` and 北京大学 is `Běijīng Dàxué`, on boundaries
138
196
  CC-CEDICT's own capitalisation states.
139
197
  - **Typed rule overrides on the lattice** (`READING_RULES`), with the modal 得
140
198
  and attested 儿化 as the first two.
@@ -167,17 +225,17 @@ decoder internals and the build pipeline.
167
225
 
168
226
  ### Accuracy at 1.0.0
169
227
 
170
- Over the 110-case gold corpus, which is committed to the repository — not to
171
- the published package — and scored by `pnpm accuracy`:
228
+ Over the 118-case gold corpus, which is committed to the repository rather than
229
+ to the published package, and scored by `pnpm accuracy`:
172
230
 
173
231
  | | lattice | greedy baseline |
174
232
  | ---------------- | --------: | --------------: |
175
- | exact match | **97.3%** | 90.9% |
176
- | reading accuracy | 99.7% | 98.7% |
177
- | spacing (F1) | **99.7%** | 96.3% |
233
+ | exact match | **97.5%** | 88.1% |
234
+ | reading accuracy | 99.7% | 98.3% |
235
+ | spacing (F1) | **99.8%** | 96.3% |
178
236
 
179
237
  Every figure in that table is asserted against the scorer by
180
- `src/changelog.test.ts`, because a number nothing executes goes stale — which is
238
+ `src/changelog.test.ts`, because a number nothing executes goes stale, which is
181
239
  what happened to this project's README table across three releases.
182
240
 
183
241
  `pnpm polyphones` reports 89.04% for the lattice against greedy's 88.82% over
package/README.md CHANGED
@@ -70,7 +70,7 @@ A command given no arguments reads standard input, one text per line, so
70
70
  dictionary at all and start without loading one.
71
71
 
72
72
  At a terminal each syllable is written in its tone's colour, in
73
- [MDBG](https://www.mdbg.net)'s palette — red, yellow, green, blue, and the
73
+ [MDBG](https://www.mdbg.net)'s palette of red, yellow, green, blue, and the
74
74
  terminal's own colour for the neutral tone. It is off for a pipe, `NO_COLOR` is
75
75
  honoured, `--colour` and `--no-colour` force it either way, and `--json` is
76
76
  never coloured. See [the command line](docs/cli/#colour).
@@ -85,9 +85,8 @@ $ pinyinjs convert 银行
85
85
  yínháng
86
86
  ```
87
87
 
88
- Everything else has columns for a person to read. Add `--json` — to any
89
- command — and it writes one JSON document per answer instead, which is what
90
- `jq` wants:
88
+ Everything else has columns for a person to read. Add `--json` to any command
89
+ and it writes one JSON document per answer instead, which is what `jq` wants:
91
90
 
92
91
  ```console
93
92
  $ pinyinjs explain 长江大桥 --json | jq -c '.syllables[] | select(.state != "locked")'
@@ -149,16 +148,16 @@ first, convert with it, and reload as `full` arrives.
149
148
  convert(dictionary, "银行"); // "yínháng"
150
149
  convert(dictionary, "行长"); // "hángzhǎng"
151
150
  convert(dictionary, "我要去北京。"); // "Wǒ yào qù Běijīng."
152
- convert(dictionary, "3D银行"); // "sān D yínháng" — the digit is read, the letter is not
151
+ convert(dictionary, "3D银行"); // "sān D yínháng", the digit is read, the letter is not
153
152
  ```
154
153
 
155
154
  A reading the dictionary cannot settle on its own is settled by context, with
156
155
  typed rules over the lattice rather than tweaks to the output:
157
156
 
158
157
  ```ts
159
- convert(dictionary, "我得走了"); // "wǒ děi zǒule" — modal 得
160
- convert(dictionary, "他跑得很快"); // "tā pǎo de hěn kuài" — the particle
161
- convert(dictionary, "那边儿"); // "nà biānr" — 儿 does not stand on its own
158
+ convert(dictionary, "我得走了"); // "wǒ děi zǒule", modal 得
159
+ convert(dictionary, "他跑得很快"); // "tā pǎo de hěn kuài", the particle
160
+ convert(dictionary, "那边儿"); // "nà biānr", 儿 does not stand on its own
162
161
  ```
163
162
 
164
163
  See [converting](docs/converting/#rules-where-the-cost-model-cannot-reach).
@@ -226,7 +225,7 @@ writes in a way no rule reaches.
226
225
 
227
226
  ```ts
228
227
  convert(dictionary, "他看了"); // "tā kànle"
229
- convert(dictionary, "我还给你了。"); // "Wǒ huán gěi nǐ le." — sentence-final 了
228
+ convert(dictionary, "我还给你了。"); // "Wǒ huán gěi nǐ le.", sentence-final 了
230
229
  convert(dictionary, "作者"); // "zuòzhě"
231
230
  convert(dictionary, "南京市"); // "Nánjīng Shì"
232
231
  convert(dictionary, "南京市", { grouping: false }); // "Nánjīngshì"
@@ -246,7 +245,7 @@ a boundary inside it.
246
245
  ```ts
247
246
  convert(dictionary, "干干净净"); // "gāngān-jìngjìng"
248
247
  convert(dictionary, "研究研究"); // "yánjiū-yánjiū"
249
- convert(dictionary, "爸爸妈妈"); // "bàba māma" — that shape, but two words
248
+ convert(dictionary, "爸爸妈妈"); // "bàba māma", that shape, but two words
250
249
  ```
251
250
 
252
251
  **A 成语 that can be read as two disyllables** takes the same hyphen, from a
@@ -254,7 +253,7 @@ curated list of 117; the rest are written solid, as the standard writes them.
254
253
 
255
254
  ```ts
256
255
  convert(dictionary, "风平浪静"); // "fēngpíng-làngjìng"
257
- convert(dictionary, "不亦乐乎"); // "búyìlèhū" — cannot be halved
256
+ convert(dictionary, "不亦乐乎"); // "búyìlèhū", cannot be halved
258
257
  ```
259
258
 
260
259
  **Digits are read**, and the rest of a non-Han run passes through exactly as
@@ -266,7 +265,7 @@ convert(dictionary, "1988年之后"); // "yī jiǔ bā bā nián zhīhòu"
266
265
  convert(dictionary, "95%的人"); // "bǎifēnzhījiǔshíwǔ de rén"
267
266
  convert(dictionary, "3D打印"); // "sān D dǎyìn"
268
267
  convert(dictionary, "6:30起床"); // "liù diǎn sānshí fēn qǐchuáng"
269
- convert(dictionary, "16:9的"); // "16:9de" — a ratio is not a quantity
268
+ convert(dictionary, "16:9的"); // "16:9de", a ratio is not a quantity
270
269
  ```
271
270
 
272
271
  `numbers: "keep"` leaves every digit alone. See [numbers](docs/numerals/).
@@ -282,13 +281,13 @@ import { convertPieces, isUncertain, writeSyllable } from "@kensio/pinyinjs";
282
281
  const pieces = convertPieces(dictionary, "银行");
283
282
  pieces.map((piece) => piece.text); // ["yín", "háng"]
284
283
  pieces[1]?.syllable; // { initial: "h", final: "ang", tone: 2 }
285
- pieces[0]?.confidence?.isLocked; // true — nothing else can be read here
284
+ pieces[0]?.confidence?.isLocked; // true, nothing else can be read here
286
285
  pieces[1]?.confidence?.alternatives.map((found) =>
287
286
  found.reading.map((syllable) => writeSyllable(syllable)).join(""),
288
287
  ); // ["xíng", "héng", "hàng"]
289
288
  ```
290
289
 
291
- A piece with no `syllable` is the text between two of them — a space, or a run
290
+ A piece with no `syllable` is the text between two of them: a space, or a run
292
291
  that was never Han. `joinPieces(pieces)` gives back exactly what `convert`
293
292
  returns.
294
293
 
@@ -306,8 +305,8 @@ const guesses = (text: string) =>
306
305
  (piece) => piece.confidence !== undefined && isUncertain(piece.confidence),
307
306
  );
308
307
 
309
- guesses("行").map((piece) => piece.text); // ["xíng"] — nothing but a prior chose it
310
- guesses("银行").map((piece) => piece.text); // [] — the word settles both syllables
308
+ guesses("行").map((piece) => piece.text); // ["xíng"], nothing but a prior chose it
309
+ guesses("银行").map((piece) => piece.text); // [], the word settles both syllables
311
310
  ```
312
311
 
313
312
  An alternative's `cost` says how much more the cheapest conversion taking it
@@ -327,7 +326,7 @@ convertToHtml(dictionary, "行");
327
326
  One element per syllable, with `py-tone-1` to `py-tone-5` (5 is the neutral
328
327
  tone), and `py-uncertain` plus the rejected readings where the decoder was
329
328
  guessing. Text that is not Han is escaped, not marked up. No styles are
330
- included — write your own:
329
+ included, so write your own:
331
330
 
332
331
  ```css
333
332
  .py-tone-1 {
@@ -348,12 +347,12 @@ have.
348
347
  const entry = dictionary.lookup("头发");
349
348
  entry?.reading; // [{ initial: "t", final: "ou", tone: 2 }, { initial: "f", final: "a", tone: 5 }]
350
349
  entry?.isProperNoun; // false
351
- entry?.partOfSpeech; // "n" — jieba's tag
350
+ entry?.partOfSpeech; // "n", jieba's tag
352
351
 
353
352
  dictionary.lookup("頭髮")?.reading; // the same reading, found under 繁體
354
353
  dictionary.lookup("重複")?.reading; // 重複 and 重覆 are both keys for 重复
355
- dictionary.hasPrefix("银"); // true — does any word start with this?
356
- dictionary.readingsOf("行"); // xíng, háng, héng, hàng — likeliest first
354
+ dictionary.hasPrefix("银"); // true, does any word start with this?
355
+ dictionary.readingsOf("行"); // xíng, háng, héng, hàng, likeliest first
357
356
  ```
358
357
 
359
358
  Both scripts are keys in the same dictionary, so nothing is converted before a
@@ -367,12 +366,12 @@ The syllable layer needs no dictionary and no network.
367
366
  import { isSyllable, readSyllable, writeSyllable } from "@kensio/pinyinjs";
368
367
 
369
368
  readSyllable("jiù"); // { initial: "j", final: "iou", tone: 4 }
370
- readSyllable("jiu4"); // the same — both notations parse
369
+ readSyllable("jiu4"); // the same, both notations parse
371
370
  readSyllable("lv4"); // { initial: "l", final: "ü", tone: 4 }
372
371
  readSyllable("hello"); // undefined
373
- readSyllable("běi3"); // undefined — one notation at a time
372
+ readSyllable("běi3"); // undefined, one notation at a time
374
373
 
375
- isSyllable("wánr"); // true — 儿化 is a suffix, not a syllable of its own
374
+ isSyllable("wánr"); // true, 儿化 is a suffix, not a syllable of its own
376
375
  ```
377
376
 
378
377
  Initials and finals are the _underlying_ forms rather than the spelling, so 就 is
@@ -390,7 +389,7 @@ Input takes either notation, the `v` and `u:` conventions for ü, and raised ton
390
389
  digits. Output is standard diacritics unless asked otherwise.
391
390
 
392
391
  Parsing answers whether a spelling is _well formed_, not whether Mandarin uses
393
- it — `shong` parses and is not a real syllable. The attested inventory is
392
+ it: `shong` parses and is not a real syllable. The attested inventory is
394
393
  separate:
395
394
 
396
395
  ```ts
@@ -410,7 +409,7 @@ splitSyllables("nǐhǎo"); // ["nǐ", "hǎo"]
410
409
  splitSyllables("Xī'ān"); // ["Xī", "ān"]
411
410
  splitSyllables("yinhang"); // ["yin", "hang"]
412
411
  splitSyllables("guórén"); // ["guó", "rén"], not ["guór", "én"]
413
- splitSyllables("hǎiōu"); // ["hǎi", "ōu"] — missing apostrophe, read anyway
412
+ splitSyllables("hǎiōu"); // ["hǎi", "ōu"], missing apostrophe, read anyway
414
413
  readWord("yínháng"); // the same, parsed into Syllable objects
415
414
  ```
416
415
 
@@ -436,20 +435,21 @@ written at all.
436
435
 
437
436
  ## Numbers
438
437
 
439
- Reading a number needs no dictionary — arithmetic and about twenty readings —
440
- so this works with nothing loaded.
438
+ Reading a number needs no dictionary, just arithmetic and about twenty
439
+ readings, so this works with nothing loaded.
441
440
 
442
441
  ```ts
443
442
  import { numeralHanzi, percentHanzi, readNumeral } from "@kensio/pinyinjs";
444
443
 
445
444
  numeralHanzi(12345); // "一万两千三百四十五"
446
- numeralHanzi(1005); // "一千零五" — a skipped place is spoken
447
- numeralHanzi(2000); // "两千" — a leading lone 2 before a big unit
448
- percentHanzi(95); // "百分之九十五" — the order reverses
445
+ numeralHanzi(1005); // "一千零五", a skipped place is spoken
446
+ numeralHanzi(2000); // "两千", a leading lone 2 before a big unit
447
+ numeralHanzi(2, { counts: true }); // "两", as in 两个西瓜, never 二个
448
+ percentHanzi(95); // "百分之九十五", the order reverses
449
449
  ```
450
450
 
451
- The same digits are read two ways and nothing in the number says which — 2026年
452
- is spelled out and 2026个 is counted — so the style is the caller's:
451
+ The same digits are read two ways and nothing in the number says which, since
452
+ 2026年 is spelled out and 2026个 is counted, so the style is the caller's:
453
453
 
454
454
  ```ts
455
455
  numeralHanzi(2026); // "两千零二十六"
@@ -484,7 +484,7 @@ writeIpa(jiu); // "tɕiou˥˩"
484
484
  ```
485
485
 
486
486
  Gwoyeu Romatzyh is the odd one, and it needs no tone mark because the tone is
487
- spelled into the syllable — which is why 陝西 is Shaanxi in English and 山西 is
487
+ spelled into the syllable, which is why 陝西 is Shaanxi in English and 山西 is
488
488
  Shanxi:
489
489
 
490
490
  ```ts
@@ -496,7 +496,7 @@ Reading Wade-Giles back gives an **array**, because real text drops the
496
496
  apostrophes and diacritics that carry the distinctions:
497
497
 
498
498
  ```ts
499
- readWadeGilesLoosely("chi¹"); // [jī, qī] — chi is jī, ch'i is qī
499
+ readWadeGilesLoosely("chi¹"); // [jī, qī]: chi is jī, ch'i is qī
500
500
  readWadeGilesLoosely("chu¹"); // [zhū, chū, jū, qū]
501
501
  ```
502
502
 
@@ -514,7 +514,7 @@ array, so it can be switched off and works across word boundaries.
514
514
  import { applySandhi, readWord } from "@kensio/pinyinjs";
515
515
 
516
516
  const buShi = readWord("bùshì") ?? [];
517
- applySandhi(buShi); // bú shì — 不 flattens before a fourth tone
517
+ applySandhi(buShi); // bú shì, 不 flattens before a fourth tone
518
518
  applySandhi(buShi, { yiBu: false }); // unchanged
519
519
 
520
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gB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC3B,SAAS,cAAc,EAAE,CAE3B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAEpE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC3B,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC3B,SAAS,cAAc,EAAE,CAE3B"}
@@ -8,6 +8,7 @@ import { toCharacters } from "../script/characters.js";
8
8
  import { writeSyllable, } from "../syllable/syllable.js";
9
9
  import { decodeRun, decodeRunScored } from "./decode.js";
10
10
  import { decodeGreedily } from "./greedy.js";
11
+ import { READING_RULES } from "./reading-rules.js";
11
12
  import { splitRuns } from "./runs.js";
12
13
  import { applySandhi } from "./sandhi.js";
13
14
  /**
@@ -68,14 +69,22 @@ function writeWord(reading, confidence, word, written) {
68
69
  * A decoder that reports no confidence at all, which is every decoder but one.
69
70
  */
70
71
  function unscored(decode) {
71
- return (dictionary, run) => decode(dictionary, run).map((word) => ({ word, confidence: [] }));
72
+ return (dictionary, run, before) => decode(dictionary, run, before).map((word) => ({ word, confidence: [] }));
72
73
  }
73
74
  /**
74
75
  * The lattice decoder, reporting nothing about its own confidence.
75
76
  */
76
- const LATTICE = unscored(decodeRun);
77
+ const LATTICE = unscored((dictionary, run, before) => decodeRun(dictionary, run, READING_RULES, before));
78
+ /**
79
+ * The lattice decoder, with what each reading was chosen over.
80
+ */
81
+ const SCORED = (dictionary, run, before) => decodeRunScored(dictionary, run, READING_RULES, before);
77
82
  /**
78
83
  * The greedy baseline, which has nothing to report either way.
84
+ *
85
+ * The context in front of a run goes unused: longest-match has no way to weigh
86
+ * one segmentation against another, which is the whole reason it is the
87
+ * baseline, and a 汉字 it cannot report would only be another thing to trim.
79
88
  */
80
89
  const GREEDY = unscored(decodeGreedily);
81
90
  /**
@@ -127,27 +136,50 @@ function wordsOf(decoded, dictionary, isGrouped) {
127
136
  : decoded;
128
137
  }
129
138
  /**
130
- * What comes after a run: the first character of the next Han, and its first
131
- * syllable.
139
+ * The Han either side of a run, as the two characters a number goes on.
132
140
  *
133
- * A number's only context. The character decides how it is read — 年 makes
134
- * 1998 a year, 个 makes 3 a count — and the syllable is what a 一 ending the
135
- * number assimilates to.
141
+ * A number's context, bar one syllable of it. The characters decide how it is
142
+ * read — 年 makes 1998 a year, 个 makes 3 a count and 2 两, and 第 makes 2 an
143
+ * ordinal — and characters are all they are, so this is known before anything
144
+ * has been decoded. Which is what lets the numbers be read first and the decode
145
+ * of the Han after them see what the digits stood for.
136
146
  */
137
- function following(runs, decoded, at) {
147
+ function surroundingCharacters(runs, at) {
148
+ const previous = runs[at - 1];
138
149
  const next = runs[at + 1];
139
- const isAfterHan = runs[at - 1]?.isHan === true;
140
- if (next?.isHan !== true) {
141
- return { after: { character: "", syllable: undefined }, isAfterHan };
142
- }
150
+ return {
151
+ following: next?.isHan === true ? (toCharacters(next.text)[0] ?? "") : "",
152
+ preceding: previous?.isHan === true
153
+ ? (toCharacters(previous.text).at(-1) ?? "")
154
+ : "",
155
+ };
156
+ }
157
+ /**
158
+ * What surrounds a run once it has been decoded: the character after it, and
159
+ * the syllable that character is read as.
160
+ *
161
+ * The syllable is the one part of a number's context that a decode has to
162
+ * supply, and it is what a 一 ending the number assimilates to.
163
+ */
164
+ function surrounding(runs, decoded, at) {
143
165
  return {
144
166
  after: {
145
- character: toCharacters(next.text)[0] ?? "",
167
+ character: surroundingCharacters(runs, at).following,
146
168
  syllable: decoded[at + 1]?.[0]?.word.reading[0],
147
169
  },
148
- isAfterHan,
170
+ isAfterHan: runs[at - 1]?.isHan === true,
149
171
  };
150
172
  }
173
+ /**
174
+ * The 汉字 a number in front of a Han run stands for, for that run's decode.
175
+ *
176
+ * Only the last segment of the run before, because only that one touches the
177
+ * Han: the D of 3D银行 comes between them, and a decode of 银行 that saw 三
178
+ * beside it would be reading a text nobody wrote.
179
+ */
180
+ function numeralBefore(segments) {
181
+ return segments.at(-1)?.hanzi ?? "";
182
+ }
151
183
  /**
152
184
  * Whether a character wants a space between it and a number read out.
153
185
  *
@@ -233,10 +265,7 @@ function runEdge(isHan) {
233
265
  * stretch is being said rather than shown, so its parts take the spacing of
234
266
  * words — 3D打印 is `sān D dǎyìn` — and punctuation still takes none.
235
267
  */
236
- function writeNumbers(text, context, written, options) {
237
- const segments = options.numbers === "keep"
238
- ? []
239
- : readNumbersIn(text, context.after.character);
268
+ function writeNumbers(text, segments, context, written, options) {
240
269
  if (segments.every((segment) => segment.reading === undefined)) {
241
270
  return [plainPiece(text)];
242
271
  }
@@ -265,12 +294,18 @@ function convertWith(decode, dictionary, text, options) {
265
294
  const { locale = "zh-CN", notation = "marks", apostrophe = "always", capitals = "auto", punctuation = "latin", grouping = true, numbers = "read", sandhi, } = options;
266
295
  const written = { notation, apostrophe, capitals };
267
296
  const converted = [];
268
- // Decoded before anything is written, because a number needs to know what
269
- // follows it — 1998年 is a year and 3个 is a count — and what follows it is
270
- // in the next run.
271
297
  const runs = [...splitRuns(text)];
272
- const decoded = runs.map((run) => run.isHan
273
- ? wordsOf(decode(dictionary, run.text), dictionary, grouping)
298
+ // Read before anything is decoded, because a number needs to know what
299
+ // follows it — 1998年 is a year and 3个 is a count — and the character that
300
+ // decides it is there for the reading without a decode of its own.
301
+ const read = runs.map((run, at) => run.isHan || numbers === "keep"
302
+ ? []
303
+ : readNumbersIn(run.text, surroundingCharacters(runs, at)));
304
+ // Decoded before anything is written, because a number's sandhi needs the
305
+ // syllable after it, and because a Han run needs the number in front of it:
306
+ // 2个人 is `liǎng gè rén` and 个人 on its own is the word `gèrén`.
307
+ const decoded = runs.map((run, at) => run.isHan
308
+ ? wordsOf(decode(dictionary, run.text, numeralBefore(read[at - 1] ?? [])), dictionary, grouping)
274
309
  : []);
275
310
  for (const [at, run] of runs.entries()) {
276
311
  const words = decoded[at] ?? [];
@@ -278,10 +313,7 @@ function convertWith(decode, dictionary, text, options) {
278
313
  converted.push(...writeRun(dictionary, words, locale, written, sandhi));
279
314
  continue;
280
315
  }
281
- converted.push(...writeNumbers(run.text, following(runs, decoded, at), written, {
282
- numbers,
283
- sandhi,
284
- }));
316
+ converted.push(...writeNumbers(run.text, read[at] ?? [], surrounding(runs, decoded, at), written, { sandhi }));
285
317
  }
286
318
  let pieces = converted;
287
319
  // Both of these read the whole conversion rather than one run: a sentence
@@ -335,7 +367,7 @@ export function convert(dictionary, text, options = {}) {
335
367
  * {@link convert} runs.
336
368
  */
337
369
  export function convertPieces(dictionary, text, options = {}) {
338
- return convertWith(decodeRunScored, dictionary, text, options);
370
+ return convertWith(SCORED, dictionary, text, options);
339
371
  }
340
372
  /**
341
373
  * Join a conversion's pieces back into the text they spell.
@@ -1 +1 @@
1
- {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/decode/convert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAwB,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EACL,uBAAuB,EACvB,cAAc,EAEd,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAEL,uBAAuB,GACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,aAAa,EACb,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAGL,aAAa,GACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,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