@kensio/pinyinjs 1.5.3 → 1.7.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.
- package/README.md +252 -5
- package/data/core.entries +462 -460
- package/data/core.freq +0 -0
- package/data/core.keys +2 -0
- package/data/full.entries +13732 -13734
- package/data/full.freq +0 -0
- package/data/full.keys +0 -2
- package/data/manifest.json +15 -15
- package/data/script.map +34 -55
- package/data/standard.entries +1354 -1352
- package/data/standard.freq +0 -0
- package/data/standard.keys +2 -0
- package/dist/cli/arguments.d.ts +38 -0
- package/dist/cli/arguments.d.ts.map +1 -1
- package/dist/cli/arguments.js +46 -0
- package/dist/cli/arguments.js.map +1 -1
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +229 -2
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +5 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/decode/convert.d.ts +58 -0
- package/dist/decode/convert.d.ts.map +1 -1
- package/dist/decode/convert.js +135 -37
- package/dist/decode/convert.js.map +1 -1
- package/dist/decode/decode.d.ts +3 -2
- package/dist/decode/decode.d.ts.map +1 -1
- package/dist/decode/decode.js +15 -10
- package/dist/decode/decode.js.map +1 -1
- package/dist/decode/hints.d.ts +138 -0
- package/dist/decode/hints.d.ts.map +1 -0
- package/dist/decode/hints.js +214 -0
- package/dist/decode/hints.js.map +1 -0
- package/dist/decode/lattice.d.ts +9 -1
- package/dist/decode/lattice.d.ts.map +1 -1
- package/dist/decode/lattice.js +5 -3
- package/dist/decode/lattice.js.map +1 -1
- package/dist/decode/reading-rules.d.ts +28 -0
- package/dist/decode/reading-rules.d.ts.map +1 -1
- package/dist/decode/reading-rules.js +157 -0
- package/dist/decode/reading-rules.js.map +1 -1
- package/dist/decode/runs.d.ts +11 -0
- package/dist/decode/runs.d.ts.map +1 -1
- package/dist/decode/runs.js +19 -0
- package/dist/decode/runs.js.map +1 -1
- package/dist/decode/segment.d.ts +66 -0
- package/dist/decode/segment.d.ts.map +1 -0
- package/dist/decode/segment.js +79 -0
- package/dist/decode/segment.js.map +1 -0
- package/dist/dictionary/artifact.d.ts +10 -0
- package/dist/dictionary/artifact.d.ts.map +1 -1
- package/dist/dictionary/artifact.js +17 -0
- package/dist/dictionary/artifact.js.map +1 -1
- package/dist/dictionary/assertions.d.ts.map +1 -1
- package/dist/dictionary/assertions.js +8 -0
- package/dist/dictionary/assertions.js.map +1 -1
- package/dist/dictionary/corpus-mass.d.ts +68 -0
- package/dist/dictionary/corpus-mass.d.ts.map +1 -0
- package/dist/dictionary/corpus-mass.js +123 -0
- package/dist/dictionary/corpus-mass.js.map +1 -0
- package/dist/dictionary/dictionary.d.ts +56 -0
- package/dist/dictionary/dictionary.d.ts.map +1 -1
- package/dist/dictionary/dictionary.js +116 -1
- package/dist/dictionary/dictionary.js.map +1 -1
- package/dist/dictionary/erhua.d.ts +4 -0
- package/dist/dictionary/erhua.d.ts.map +1 -1
- package/dist/dictionary/erhua.js +6 -0
- package/dist/dictionary/erhua.js.map +1 -1
- package/dist/dictionary/frequency-table.js +1 -1
- package/dist/dictionary/locale.js +2 -2
- package/dist/dictionary/merge.d.ts.map +1 -1
- package/dist/dictionary/merge.js +46 -9
- package/dist/dictionary/merge.js.map +1 -1
- package/dist/dictionary/tiers.d.ts +2 -1
- package/dist/dictionary/tiers.d.ts.map +1 -1
- package/dist/dictionary/tiers.js +77 -11
- package/dist/dictionary/tiers.js.map +1 -1
- package/dist/format/html.d.ts +32 -0
- package/dist/format/html.d.ts.map +1 -1
- package/dist/format/html.js +144 -0
- package/dist/format/html.js.map +1 -1
- package/dist/grade/check.d.ts +156 -0
- package/dist/grade/check.d.ts.map +1 -0
- package/dist/grade/check.js +356 -0
- package/dist/grade/check.js.map +1 -0
- package/dist/index.d.ts +14 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/search/candidates.d.ts +84 -0
- package/dist/search/candidates.d.ts.map +1 -0
- package/dist/search/candidates.js +290 -0
- package/dist/search/candidates.js.map +1 -0
- package/dist/search/match.d.ts +72 -0
- package/dist/search/match.d.ts.map +1 -0
- package/dist/search/match.js +419 -0
- package/dist/search/match.js.map +1 -0
- package/dist/search/query.d.ts +49 -0
- package/dist/search/query.d.ts.map +1 -0
- package/dist/search/query.js +115 -0
- package/dist/search/query.js.map +1 -0
- package/dist/search/reverse-index.d.ts +141 -0
- package/dist/search/reverse-index.d.ts.map +1 -0
- package/dist/search/reverse-index.js +356 -0
- package/dist/search/reverse-index.js.map +1 -0
- package/dist/sources/unihan.d.ts +22 -4
- package/dist/sources/unihan.d.ts.map +1 -1
- package/dist/sources/unihan.js +74 -13
- package/dist/sources/unihan.js.map +1 -1
- package/package.json +2 -3
- package/CHANGELOG.md +0 -485
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unihan.js","sourceRoot":"","sources":["../../src/sources/unihan.ts"],"names":[],"mappings":"AAgCA;;GAEG;AACH,MAAM,UAAU,GAAG,+BAA+B,CAAC;AAEnD;;;GAGG;AACH,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"unihan.js","sourceRoot":"","sources":["../../src/sources/unihan.ts"],"names":[],"mappings":"AAgCA;;GAEG;AACH,MAAM,UAAU,GAAG,+BAA+B,CAAC;AAEnD;;;GAGG;AACH,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAE9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,aAAa;IACb,WAAW;IACX,WAAW;IACX,UAAU;CACF,CAAC;AAOX;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,aAAoC,CAAC;AAEpE;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,KAAmB,EAAE,KAAa;IACxD,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAA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CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC,CAC3D,CAAC;QACJ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,MAAM,MAAM,GACV,SAAS,KAAK,oBAAoB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;QAChE,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AACrC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kensio/pinyinjs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Chinese hanzi to pinyin conversion",
|
|
5
5
|
"repository": "https://github.com/KensioSoftware/pinyinjs",
|
|
6
6
|
"homepage": "https://pinyinjs.dev",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"dist",
|
|
27
27
|
"data",
|
|
28
28
|
"README.md",
|
|
29
|
-
"CHANGELOG.md",
|
|
30
29
|
"LICENSE",
|
|
31
30
|
"NOTICE"
|
|
32
31
|
],
|
|
@@ -67,7 +66,7 @@
|
|
|
67
66
|
"@types/node": "^26.0.0",
|
|
68
67
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
69
68
|
"@vitest/coverage-v8": "^4.1.10",
|
|
70
|
-
"conventional-changelog-conventionalcommits": "
|
|
69
|
+
"conventional-changelog-conventionalcommits": "9.3.1",
|
|
71
70
|
"fta-cli": "^3.0.0",
|
|
72
71
|
"jiti": "^2.7.0",
|
|
73
72
|
"oxfmt": "^0.62.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,485 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
Notable changes to `@kensio/pinyinjs`. Versions follow
|
|
4
|
-
[semantic versioning](https://semver.org) from 1.0.0 onward.
|
|
5
|
-
|
|
6
|
-
Two things are outside the version contract, for the reasons
|
|
7
|
-
[the API page](docs/api/#stability) gives: the readings a conversion produces,
|
|
8
|
-
which a dictionary rebuild can change, and the artifact format under `data/`.
|
|
9
|
-
|
|
10
|
-
## Unreleased
|
|
11
|
-
|
|
12
|
-
## 1.5.3
|
|
13
|
-
|
|
14
|
-
### Fixed
|
|
15
|
-
|
|
16
|
-
- **The changelog inside the package described five releases as unreleased.**
|
|
17
|
-
Every tarball from 1.1.0 to 1.5.2 shipped a `## Unreleased` section holding
|
|
18
|
-
everything since 1.0.0, so a reader who opened the copy they installed —
|
|
19
|
-
which [the API page](docs/api/#stability) points them at — had no way to tell
|
|
20
|
-
which version any of it arrived in. The entries are filed under the versions
|
|
21
|
-
that shipped them now. No code changes; this release exists to put the
|
|
22
|
-
corrected file on the registry.
|
|
23
|
-
|
|
24
|
-
## 1.5.2
|
|
25
|
-
|
|
26
|
-
### Fixed
|
|
27
|
-
|
|
28
|
-
- **Third-tone sandhi ran over the syllables rather than over the feet.** The
|
|
29
|
-
rule is usually stated as "a third tone before another third tone is said as
|
|
30
|
-
a second", and a left-to-right scan of a reading applying exactly that is
|
|
31
|
-
wrong about as often as it is right: sandhi's domain is the prosodic foot,
|
|
32
|
-
which is built out of structure ([Shih 1986][1]). 這家銀行的行長很喜歡旅行
|
|
33
|
-
came out `hángzháng hén xǐhuan`, running the subject into the predicate, and
|
|
34
|
-
紙老虎 came out `zhíláohǔ`.
|
|
35
|
-
|
|
36
|
-
Three passes now, innermost first, each reading what the one before it left.
|
|
37
|
-
Inside a constituent, every third tone but the last lowers. Between the
|
|
38
|
-
constituents of a word, so that 展覽館 is 展覽 + 館 and stays `zhánlánguǎn`
|
|
39
|
-
while 紙老虎 is 紙 + 老虎 and becomes `zhǐláohǔ` — the dictionary is asked
|
|
40
|
-
where a word divides, and only proposes one where both halves are words. And
|
|
41
|
-
between a monosyllabic word and the word after it, which it leans on: 我也很好
|
|
42
|
-
is `wó yé hén hǎo`, but 行長 and 老闆 keep their second syllable.
|
|
43
|
-
|
|
44
|
-
`applySandhi` takes a `SandhiGrouping` for this, and without one still treats
|
|
45
|
-
the whole reading as a single word. `convert` passes what the decoder found;
|
|
46
|
-
the `sandhi` command splits its argument on whitespace.
|
|
47
|
-
|
|
48
|
-
What is given up is the monosyllable leaning backwards — 保管好 is
|
|
49
|
-
`báoguán hǎo` and comes out `báoguǎn hǎo` — which needs to know which way it
|
|
50
|
-
attaches, a question about syntax rather than about the words.
|
|
51
|
-
|
|
52
|
-
[1]: https://www.researchgate.net/publication/36071823_The_Prosodic_Domain_of_Tone_Sandhi_in_Chinese
|
|
53
|
-
|
|
54
|
-
- **14 characters read wrongly under `zh-TW`.** CC-CEDICT states a `Taiwan pr.`
|
|
55
|
-
note either as a definition of its own, where it qualifies the headword's
|
|
56
|
-
reading, or parenthesised inside one sense, where it qualifies that sense —
|
|
57
|
-
and the merge took both as facts about the headword. 從's `zòng` is the 侍從
|
|
58
|
-
and 從兄弟 senses, all of them bound forms, so `我從北京來` read
|
|
59
|
-
`wǒ zòng Běijīng lái`; 會 took `huǐ` from 一會兒 and `很會說話` followed it.
|
|
60
|
-
A note now has to cover the sense the entry leads with, which is what a
|
|
61
|
-
character means with nothing to narrow it — 和's `hàn` is the conjunction, and
|
|
62
|
-
it stays. Also fixed for 勞, 燥, 行, 勝, 匹, 多, 抵, 枕, 比, 玩, 署 and 聽.
|
|
63
|
-
Compounds keep their own notes, so 肉燥麵 is still `ròusào miàn`.
|
|
64
|
-
|
|
65
|
-
Only a character is tested this way; a word is reached only where it is
|
|
66
|
-
written, so 相親 keeps the `xiàngqīn` its dominant sense carries. CC-CEDICT
|
|
67
|
-
now supplies 335 deltas rather than 349.
|
|
68
|
-
|
|
69
|
-
## 1.5.1
|
|
70
|
-
|
|
71
|
-
Tooling and test-suite work only; nothing a consumer installs changed.
|
|
72
|
-
|
|
73
|
-
## 1.5.0
|
|
74
|
-
|
|
75
|
-
### Added
|
|
76
|
-
|
|
77
|
-
- **`convertToHtml` declares what language it is emitting.** Every syllable
|
|
78
|
-
element now carries `lang="zh-Latn-CN-pinyin"`, or `zh-Latn-TW-pinyin` where
|
|
79
|
-
the conversion read `zh-TW`. Nothing about `yín` on its own says it is
|
|
80
|
-
Mandarin in the Latin alphabet, so without the tag a screen reader pronounces
|
|
81
|
-
it as whatever the surrounding page claims to be — English, usually — and the
|
|
82
|
-
browser hyphenates it that way too. The subtags are all registered, and the
|
|
83
|
-
`pinyin` variant's prefix in the IANA registry is `zh-Latn`.
|
|
84
|
-
|
|
85
|
-
**This changes the markup existing callers get**, which is why it is worth
|
|
86
|
-
saying plainly: the classes are unchanged, and `lang` is a new attribute
|
|
87
|
-
between `class` and `data-alternatives`. `lang: false` — `--no-lang` at the
|
|
88
|
-
command line — leaves it off, for a caller who would rather declare the
|
|
89
|
-
language once on a wrapper of their own than repeat it on every syllable.
|
|
90
|
-
|
|
91
|
-
## 1.4.0
|
|
92
|
-
|
|
93
|
-
### Added
|
|
94
|
-
|
|
95
|
-
- **`pinyinjs script`,** script conversion at the command line, with `--to` for
|
|
96
|
-
the target and `--from-script` where the text is too short for detection to
|
|
97
|
-
tell. The lines carry the converted text and nothing else so it pipes;
|
|
98
|
-
`--json` carries the per-character evidence and what was uncertain. Also a
|
|
99
|
-
[script conversion](docs/script-conversion/) page, which the README and the
|
|
100
|
-
docs index now point at — `toScript` shipped with one row in the API table
|
|
101
|
-
and nothing a reader would find.
|
|
102
|
-
|
|
103
|
-
- **`toScript`,** 简体 ↔ 繁體 conversion. 我们后来发现了头发问题 is
|
|
104
|
-
我們後來發現了頭髮問題. The reading is the evidence, in both directions, and it
|
|
105
|
-
is what nothing else in this space has: 发 is 發 or 髮 and only `fà` tells them
|
|
106
|
-
apart; 干 is 幹, 乾 or 干; 乾 stays 乾 in 乾隆 and simplifies to 干 in 乾燥.
|
|
107
|
-
Every other converter resolves these from a phrase table alone. This one
|
|
108
|
-
segments with the lattice and reads the result, so it generalises to words no
|
|
109
|
-
phrase table lists.
|
|
110
|
-
|
|
111
|
-
Evidence is taken strongest first — a word some source wrote in both scripts,
|
|
112
|
-
then the character at the reading it was decoded with, then the character's
|
|
113
|
-
commonest form — and `toScriptPieces` reports which of those settled every
|
|
114
|
-
character. `isUncertainChoice` marks the last one, the only case that is a
|
|
115
|
-
guess: 下面 is a surface or a bowl of noodles and nothing here can tell, so it
|
|
116
|
-
says so rather than picking silently. Over the gold corpus 97.7% of characters
|
|
117
|
-
are locked and 1.5% are guesses.
|
|
118
|
-
|
|
119
|
-
Targets are BCP-47: `zh-Hans`, `zh-Hant`, `zh-Hant-TW`, `zh-Hant-HK`, with a
|
|
120
|
-
bare `zh-Hant` taking Taiwan. The input script is detected unless `from` names
|
|
121
|
-
it, which matters more than it sounds — plenty of characters are current in
|
|
122
|
-
both scripts, so running 繁體 through the 简→繁 tables would turn 准將 into
|
|
123
|
-
準將.
|
|
124
|
-
|
|
125
|
-
**This is orthography, not translation.** 軟體 and 软件 are different words
|
|
126
|
-
rather than two spellings of one. OpenCC folds that into script conversion
|
|
127
|
-
with `s2twp`; pinyinjs does not.
|
|
128
|
-
|
|
129
|
-
- **`data/script.map`,** the conversion tables, as their own fetchable file:
|
|
130
|
-
282 KB, 96 KB brotli, loaded by `loadScriptTables` only when something asks
|
|
131
|
-
to convert. A caller converting hanzi to pinyin pays nothing for it. The
|
|
132
|
-
character tables alone are right for 99.13% of the 267,639 entries whose two
|
|
133
|
-
scripts differ, and the word exception lists cover the rest.
|
|
134
|
-
|
|
135
|
-
- **`hansOnly` and `hantOnly`,** the character sets `detectScript` has always
|
|
136
|
-
taken and nothing shipped. They ride in the same file.
|
|
137
|
-
|
|
138
|
-
- **Round-trip scoring in `pnpm accuracy`.** 繁→简 is near-deterministic, so
|
|
139
|
-
简→繁→简 has to be the identity for essentially every key — half a million
|
|
140
|
-
cases with no hand-labelling, and every failure a real defect. It reports
|
|
141
|
-
99.6% over the words in use and 99.3% over every key. The reverse trip is
|
|
142
|
-
lossy by design and is reported rather than targeted.
|
|
143
|
-
|
|
144
|
-
- **Hong Kong 繁體 glyph forms are recognised on the lookup path.** Taiwan and
|
|
145
|
-
Hong Kong write the same characters with the same readings and disagree about
|
|
146
|
-
the standard form of 58 of them — 裡 against 裏, 群 against 羣, 麵 against 麪.
|
|
147
|
-
Hong Kong spellings were missing dictionary keys and falling back to
|
|
148
|
-
converting character by character, so 羣眾 and 麪包 read worse than 群眾 and
|
|
149
|
-
麵包 did. The lookup path now normalises 繁體 glyph forms to the Taiwan
|
|
150
|
-
standard the keys are already built from: measured over the 9,833 keys with a
|
|
151
|
-
distinct Hong Kong spelling, 2,358 were already keys and normalisation reaches
|
|
152
|
-
a further 5,439. Only the reading is taken from the normalised form — the
|
|
153
|
-
characters a caller gets back are the ones they wrote. `toCanonicalGlyphs`,
|
|
154
|
-
`toRegionalGlyphs` and the `Region` type are exported for it, and
|
|
155
|
-
SCRIPTS-AND-LOCALES.md carries the reasoning.
|
|
156
|
-
|
|
157
|
-
Nineteen of OpenCC's mappings are deliberately not applied, because the
|
|
158
|
-
variant is a live spelling rather than a regional one. Six are current 繁體 —
|
|
159
|
-
台 appears 164 times in CC-CEDICT against 臺's 208 — and thirteen are current
|
|
160
|
-
**简体**, because the PRC simplification adopted the same 新字形 conventions
|
|
161
|
-
Hong Kong did: 着, 温, 脱, 户, 税, 卧, 悦, 兑, 葱, 幺, 棱, 檐, 痹. Normalising
|
|
162
|
-
those would have rewritten 简体 text, and 走着 `zǒuzhe` is the case that
|
|
163
|
-
caught it.
|
|
164
|
-
|
|
165
|
-
- **OpenCC as a data source.** Its 简体 ↔ 繁體 character tables and the Taiwan
|
|
166
|
-
and Hong Kong variant tables, Apache-2.0, attributed in `NOTICE`. The glyph
|
|
167
|
-
tables are held in `src/script/glyphs.ts` as code rather than shipped as an
|
|
168
|
-
artifact, since 120 mappings do not justify a download and they have to work
|
|
169
|
-
before any dictionary has loaded; `pnpm build:data` re-derives them from
|
|
170
|
-
OpenCC and fails the build if the two have drifted.
|
|
171
|
-
|
|
172
|
-
### Fixed
|
|
173
|
-
|
|
174
|
-
- **240 dictionary entries could not be looked up at all.** Recognising Hong
|
|
175
|
-
Kong glyph forms on the lookup path means a key written in a form the path
|
|
176
|
-
normalises _away from_ can never be found, and the merge derived 繁體 forms
|
|
177
|
-
per word from Unihan's variant lists with no single standard behind them — so
|
|
178
|
-
it wrote 裏 where the corpus overwhelmingly writes 裡, and 上樑, 中峯 and 义藴
|
|
179
|
-
became keys nothing could reach. The merge now derives canonical glyph forms,
|
|
180
|
-
and keys a headword's canonical spelling alongside it where the phrase corpus
|
|
181
|
-
wrote one with a 繁體 variant. **No key is now unreachable**, and Hong Kong
|
|
182
|
-
spellings resolve slightly better than before: 5,499 of the 9,978 keys with a
|
|
183
|
-
distinct Hong Kong form, against 5,439.
|
|
184
|
-
|
|
185
|
-
Two things had to be got right alongside it. The evidence for "简体 writes
|
|
186
|
-
this character" comes from CC-CEDICT entries whose two columns differ, not
|
|
187
|
-
from the phrase corpus, which is nominally 简体 but carries 峯, 藴 and 枱 of
|
|
188
|
-
its own — counting it cut the table from 50 mappings to 32 and stopped Hong
|
|
189
|
-
Kong text converting at all. And a 繁體 form differing from its 简体 one only
|
|
190
|
-
by glyph normalisation is not evidence about script, or the alias key would
|
|
191
|
-
put that entry's 简体 characters into the 繁體-only set, which is how 发
|
|
192
|
-
briefly stopped being 简体-only.
|
|
193
|
-
|
|
194
|
-
`toScript` drops the pass that was papering over this. Key counts move:
|
|
195
|
-
723,149 for `full`, 97,997 for `standard`, 16,975 for `core`.
|
|
196
|
-
|
|
197
|
-
## 1.3.0
|
|
198
|
-
|
|
199
|
-
### Added
|
|
200
|
-
|
|
201
|
-
- **`slug`,** hanzi to a URL-safe slug: 我想学中文。 is
|
|
202
|
-
`wo3-xiang3-xue2-zhong1wen2`. Built on the decode rather than on a finished
|
|
203
|
-
string, which is the whole point of it — 银行 is `yin2hang2` and not
|
|
204
|
-
`yin2xing2`, the separators fall on the word boundaries 分词连写 found, and
|
|
205
|
-
西安 keeps its 隔音符号 as a break so a toneless slug is `xi-an` rather than
|
|
206
|
-
`xian`, which is a different word. Tones are written by default because
|
|
207
|
-
dropping them collides, and `hash` puts a short hash of the _hanzi_ on the end
|
|
208
|
-
for the homophones tones cannot separate: 权利 and 权力 are both `quan2li4`.
|
|
209
|
-
The options generalise it past URLs to search keys and identifiers, which the
|
|
210
|
-
[slug page](docs/slug/) tabulates. `pinyinjs slug` at the command line.
|
|
211
|
-
|
|
212
|
-
## 1.2.2
|
|
213
|
-
|
|
214
|
-
### Added
|
|
215
|
-
|
|
216
|
-
- **`TEACHING_JIAO` and `COUNTED_MEASURE`,** two more lattice rules, and
|
|
217
|
-
`QUANTITY_CHARACTERS`, the 汉字 a quantity is written with that the second of
|
|
218
|
-
them asks about. See the fixes below for what they do and what they measure.
|
|
219
|
-
|
|
220
|
-
- **`counts` on the numeral options.** Whether the number stands immediately in
|
|
221
|
-
front of something it counts, which is what makes a lone 2 两:
|
|
222
|
-
`numeralHanzi(2, { counts: true })` is `两` and `numeralHanzi(2)` is `二`.
|
|
223
|
-
Unlike `liang` it is not a variable choice — 二个 is simply wrong — but
|
|
224
|
-
nothing about the number says whether it is counting, so the caller says.
|
|
225
|
-
`convert` sets it from the character after the digits.
|
|
226
|
-
|
|
227
|
-
### Fixed
|
|
228
|
-
|
|
229
|
-
- **教 was `jiào` even where it was teaching.** 他在北京大学教了三年书 came out
|
|
230
|
-
`jiàole sān nián shū`, and 我教英语, 谁教你法语 and 她教我如何游泳 with it.
|
|
231
|
-
The dictionary stores 教 as `jiào` with `jiāo` as an alternate, and `jiào` is
|
|
232
|
-
right for the compounds — 教育, 教师, 宗教, 主教 — which are words and reach
|
|
233
|
-
their reading through the word; what is left is the 教 standing as a word of
|
|
234
|
-
its own, and that one is the verb. The object is what says so: a pronoun, a
|
|
235
|
-
noun or a name after it, or an aspect particle, since only a verb takes 了,
|
|
236
|
-
过 or 得. Forcing the character's own reading was not enough on its own,
|
|
237
|
-
because a two-character reading carries its 教 into the position from
|
|
238
|
-
outside — 王老师教我们汉语 read `jiào` off 师教 and 来教我 off 来教 — so an
|
|
239
|
-
untagged pair ending in 教 goes too, while every tagged word keeps its
|
|
240
|
-
reading: 任教, 宗教, 主教, 佛教, 传教, 执教, 请教, 家教. Over 88,866 lines
|
|
241
|
-
181 教 decode as a word of their own and every one read `jiào`; 158 are now
|
|
242
|
-
`jiāo`, three of them wrongly — 统一教创始人, 方法教深思 and 做到了教政分离,
|
|
243
|
-
where a nominal compound takes an object's shape. CPP's polyphone score is
|
|
244
|
-
89.05%, up from 89.04%.
|
|
245
|
-
|
|
246
|
-
- **A 量词 was swallowed by the word behind it.** 三个人 was `sān gèrén`, three
|
|
247
|
-
_personals_, because 个人 is a common noun and nothing weighed it against the
|
|
248
|
-
个 belonging to the 三 in front of it. It is now `sān gè rén`, and so are
|
|
249
|
-
两家人, 三杯水, 四匹马, 十八层楼 and 一段长时间. What makes it decidable is
|
|
250
|
-
that the dictionary tags the 量词: 个, 次, 天 and 杯 are `q`, while the
|
|
251
|
-
characters that only look like measure words in this position are not — 分 is
|
|
252
|
-
a verb, 部 and 成 are nouns, 年 and 点 are numerals — so 五分钟, 三部分,
|
|
253
|
-
五成分, 五年级 and 三点钟 are untouched, and those are exactly the words a
|
|
254
|
-
blanket rule would break. Nor does an ordinal count anything (第三集团军), nor
|
|
255
|
-
a numeral inside a longer word (唯一道路), and a number and its measure
|
|
256
|
-
written solid survive whole where the dictionary has them: 一辈子, 一会儿,
|
|
257
|
-
一口气 and 两口子 are unchanged. Over 88,866 lines the rule forbids 561 edges
|
|
258
|
-
and moves 53 decodes, three of them wrongly — 一批评, 这一名词 and 六七股灾,
|
|
259
|
-
where the 一 and the 六七 count nothing. Exactly one reading changes in the
|
|
260
|
-
whole corpus and it is a fix: 已经下了两天雨了 read 天雨 as `tiān yù`.
|
|
261
|
-
|
|
262
|
-
- **The Han after a number was decoded without it.** 2个人 was `liǎng gèrén`
|
|
263
|
-
while 两个人 written out was already `liǎng gè rén`, because a Han run was
|
|
264
|
-
decoded on its own and had no idea a number preceded it. A run is now decoded
|
|
265
|
-
with the 汉字 the digits stand for in front of it, and reported without them,
|
|
266
|
-
so digits and 汉字 reach the same decode. `decodeRun` and `decodeRunScored`
|
|
267
|
-
take that context as a fourth argument; where a reading would straddle the
|
|
268
|
-
join — 1点儿事, whose 一点儿 is one `yìdiǎnr` over both sides of it — the run
|
|
269
|
-
is decoded alone, as before.
|
|
270
|
-
|
|
271
|
-
- **A lone 2 in front of a 量词 was read 二.** 我们买了2个西瓜 came out as
|
|
272
|
-
`wǒmen mǎile èr gè xīguā`, and a 2 standing immediately in front of what it
|
|
273
|
-
counts is 两: it is now `liǎng gè`, and 2岁 is `liǎng suì`, 2点 `liǎng diǎn`
|
|
274
|
-
and 2万人 `liǎng wàn rén`, the same 两 that 2,000 and 2:00 already got. The
|
|
275
|
-
measure words a 2 can count with are an open list, so 两 is the default and
|
|
276
|
-
the exceptions are named — 月, 日, 号, 楼, 路, 班 and 期, where the digit
|
|
277
|
-
labels a position rather than counting (2月 is `èr yuè`), an ordinal, which
|
|
278
|
-
the 第 in front of it marks (第2次 is `dì èr cì`), and 十 and 百, which follow
|
|
279
|
-
二 as 20 and 200 already do. A 2 inside a larger number is untouched: 12个 is
|
|
280
|
-
still `shí'èr gè`.
|
|
281
|
-
|
|
282
|
-
## 1.2.1
|
|
283
|
-
|
|
284
|
-
### Fixed
|
|
285
|
-
|
|
286
|
-
- **A decimal lost the grouping of its counted part.** 一共75.5元 was
|
|
287
|
-
`yígòng qī shí wǔ diǎn wǔ yuán`, with the 75 in loose syllables, and is now
|
|
288
|
-
`yígòng qīshíwǔ diǎn wǔ yuán`, the same word 一共75元 already got. Only what
|
|
289
|
-
follows the 点 is read a digit at a time, and that part is unchanged: 3.14 is
|
|
290
|
-
still `sān diǎn yī sì`, and sandhi still stops at the point.
|
|
291
|
-
|
|
292
|
-
- **A decimal point was read as a full stop.** 一共75.5元 came back as
|
|
293
|
-
`Yígòng …`, capitalised as though the text were a sentence, and a conversion
|
|
294
|
-
keeping its digits capitalised again after the point: 我有75.5个。was
|
|
295
|
-
`Wǒ yǒu75.5Gè.` A stop between two digits now ends no sentence.
|
|
296
|
-
|
|
297
|
-
- **A compound lost the zh-TW reading its own parts carry.** 垃圾分類 read
|
|
298
|
-
`lājīfēnlèi` under `zh-TW`, because CC-CEDICT marks `Taiwan pr.` on 垃圾 and
|
|
299
|
-
垃圾桶 and on no other compound, and the decoder prefers the longer word, so
|
|
300
|
-
the entry that had the delta was never consulted. 101 compounds now compose
|
|
301
|
-
one from their constituents, 垃圾 accounting for 14 of them and 比肩, 玳瑁,
|
|
302
|
-
从容, 骨头, 蜗牛 and 说服 for most of the rest. Three guards keep it honest:
|
|
303
|
-
the constituent has to survive segmentation (運行狀況 contains 行狀 but reads
|
|
304
|
-
運行 + 狀況), it has to be read in the compound exactly as its own entry reads
|
|
305
|
-
it, and it has to be a whole word rather than a bare character, since 會's `huǐ`
|
|
306
|
-
would rewrite 三合會 as `sānhéhuǐ` and 3,743 entries would compose that way
|
|
307
|
-
against the 101 that whole words compose.
|
|
308
|
-
|
|
309
|
-
- **A character's zh-TW delta was often a choice between its 普通话 senses.**
|
|
310
|
-
从容地 read `cōngróng dì` and 他都知道 read `tā dū zhīdào` under `zh-TW`,
|
|
311
|
-
because 地 was stored with a Taiwan reading of `dì` and 都 with `dū`. Neither
|
|
312
|
-
is a locale shift: CC-CEDICT lists 地[de5] and 地[di4] as separate entries, so
|
|
313
|
-
`dì` is what 地 reads in 普通话 when it means the ground, and the adverbial
|
|
314
|
-
particle is `de` in Taipei too. A delta the word already has as a 普通话 sense
|
|
315
|
-
is now refused, so 71 characters and 3 words lose one, 都, 着, 应, 差, 称, 斗,
|
|
316
|
-
舍, 薄 and 万 among them, while 和 `hàn`, 期 `qí`, 垃 `lè` and 髮 `fǎ` stay,
|
|
317
|
-
no 普通话 sense reading any of those that way. A `Taiwan pr.` note is also
|
|
318
|
-
only read off a sense matching the reading the entry settled on, which drops
|
|
319
|
-
16 more: the note on 著's chess-move sense, which reads `zhāo`, had been
|
|
320
|
-
giving the aspect particle 着 a 國語 reading of `zhuó`.
|
|
321
|
-
|
|
322
|
-
- **A locale delta overwrote a reading it was not measured against.** The delta
|
|
323
|
-
describes the entry's own 普通话 reading, so a polyphone the decode read some
|
|
324
|
-
other way, such as 得 forced to the modal `děi` rather than the particle `de`
|
|
325
|
-
its entry stores, now keeps what the decode worked out instead of being
|
|
326
|
-
rewritten from the entry.
|
|
327
|
-
|
|
328
|
-
## 1.2.0
|
|
329
|
-
|
|
330
|
-
### Fixed
|
|
331
|
-
|
|
332
|
-
- **`--system ipa` capitalised the IPA.** 我去银行。他姓王。 came out as
|
|
333
|
-
`Uo˨˩˦ ... Tʰa˥ ɕiŋ˥˩ Uaŋ˧˥`, with the sentence capital and the proper noun
|
|
334
|
-
carried over from the pinyin as though a transcription spelled words. IPA
|
|
335
|
-
letters are symbols rather than an alphabet, since `[T]` is not `[t]` in a
|
|
336
|
-
larger size but a symbol the IPA does not have, so the capitals are now dropped for
|
|
337
|
-
IPA and bopomofo and kept for the three romanisations. `toTranscription`
|
|
338
|
-
takes `{ capitals: false }` for callers writing their own.
|
|
339
|
-
|
|
340
|
-
## 1.1.0
|
|
341
|
-
|
|
342
|
-
### Added
|
|
343
|
-
|
|
344
|
-
- **`SYLLABLE_TONES` and `isAttestedTone`.** Which tones each of the 424
|
|
345
|
-
syllables is actually written in, extracted from the merged dictionary and
|
|
346
|
-
held to it by a build assertion. 424 syllables in five tones would be 2,120
|
|
347
|
-
combinations and only 1,708 of them occur, so a fifth of that grid is empty.
|
|
348
|
-
|
|
349
|
-
- **`Syllable.originalTone`,** the tone a neutral syllable had before it was
|
|
350
|
-
reduced. Gwoyeu Romatzyh writes the neutral tone as a dot in front of the
|
|
351
|
-
syllable _in its original tonal spelling_, so 没有 méiyou is `mei.yeou`, and
|
|
352
|
-
nothing else in a pinyin syllable records what that tone was. Optional, never
|
|
353
|
-
inferred, and used by GR alone.
|
|
354
|
-
|
|
355
|
-
- **Two more outside sources for the transcription tables.** 148 words from
|
|
356
|
-
en.wiktionary's Mandarin pronunciation blocks, in bopomofo, Wade-Giles, Yale
|
|
357
|
-
and GR with their tones, and all 50 rows of Wikipedia's _Help:IPA/Mandarin_
|
|
358
|
-
key. The 417-row syllabary already checked was toneless, so it could say
|
|
359
|
-
nothing about tone marks, the neutral tone, 儿化 or how a word is joined,
|
|
360
|
-
which is where the four fixes below were found.
|
|
361
|
-
|
|
362
|
-
### Fixed
|
|
363
|
-
|
|
364
|
-
- **Bopomofo wrote the tone mark after the 儿化 ㄦ.** 哪儿 nǎr was `ㄋㄚㄦˇ` and
|
|
365
|
-
is now `ㄋㄚˇㄦ`: the mark belongs to the nucleus and the suffix is not part of
|
|
366
|
-
what it marks. A mark written after the ㄦ is still read.
|
|
367
|
-
|
|
368
|
-
- **Wade-Giles put the tone digit on the 儿化 suffix,** so 花儿 huār was
|
|
369
|
-
`hua-êrh¹`, a first-tone 兒. It is now `hua¹-'rh`, with the digit on the
|
|
370
|
-
syllable the tone belongs to and the suffix written as the reduced `'rh` that
|
|
371
|
-
keeps it apart from 女儿 nǚ'ér's `nü³-êrh²`.
|
|
372
|
-
|
|
373
|
-
- **Gwoyeu Romatzyh wrote 儿化 as a plain `-l` suffix.** GR fuses it into the
|
|
374
|
-
rime instead, and the rules are now implemented as _Spelling in Gwoyeu
|
|
375
|
-
Romatzyh_ gives them: 玩儿 wánr is `wal` rather than `wanl`, 事儿 shìr is
|
|
376
|
-
`shell`, 今儿 jīnr is `jiel`. The fusion is many-to-one, so `jiel` is 今儿 and
|
|
377
|
-
鸡儿 both and 128 forms no longer round-trip, every one of them a form the
|
|
378
|
-
language does not write.
|
|
379
|
-
|
|
380
|
-
- **Gwoyeu Romatzyh wrote `.mhe` for a neutral 么.** The `-h-` is the first tone
|
|
381
|
-
of a sonorant initial, and a neutral syllable is in no tone at all; the basic
|
|
382
|
-
form goes behind the dot, so 什么 shénme is `shern.me`.
|
|
383
|
-
|
|
384
|
-
- **The IPA module said it followed _Help:IPA/Mandarin_ and did not.** It
|
|
385
|
-
follows the broader IPA column of _Comparison of Standard Chinese
|
|
386
|
-
transcription systems_, which is where its ground truth comes from; the two
|
|
387
|
-
pages differ at the medials, -ang, the empty rhyme and the diphthongs. No
|
|
388
|
-
output changed, only the claim.
|
|
389
|
-
|
|
390
|
-
### Changed
|
|
391
|
-
|
|
392
|
-
- **Reading a romanisation narrows on the tone that was written.**
|
|
393
|
-
`readWadeGiles("lo²")` was `[luó, ló]` and is now `[luó]`: 咯 is a
|
|
394
|
-
sentence-final particle and is only ever neutral, so ló is not a syllable
|
|
395
|
-
Mandarin has. The same goes for `readWadeGilesLoosely`, where `pan²` is pán
|
|
396
|
-
alone, and for `readYale`, `readIpa` and `readGwoyeu`, where it settles the 儿化
|
|
397
|
-
collisions the same way (`ell` is 二 èr, there being no first-tone 兒).
|
|
398
|
-
Narrowing never empties a list: a tone no candidate is written in leaves the
|
|
399
|
-
candidates alone, since that says the tone is wrong rather than the spelling.
|
|
400
|
-
Over the phrase corpus, taking the first candidate recovers 82.66% of
|
|
401
|
-
syllables when the tone digit is written, against 79.05% without it.
|
|
402
|
-
|
|
403
|
-
- Eight Wade-Giles forms no longer round-trip, and one to three in each of the
|
|
404
|
-
other systems, because they are forms the language does not write: `lo` in the
|
|
405
|
-
four contour tones, a first-tone 兒, and a neutral 誒. Every attested
|
|
406
|
-
syllable-and-tone combination still comes back.
|
|
407
|
-
|
|
408
|
-
## 1.0.0
|
|
409
|
-
|
|
410
|
-
The first stable release. Everything the
|
|
411
|
-
[API page](docs/api/) lists is now covered by semantic versioning, including the
|
|
412
|
-
decoder internals and the build pipeline.
|
|
413
|
-
|
|
414
|
-
### Added since 0.1.0-beta.0
|
|
415
|
-
|
|
416
|
-
- **Transcription systems, all five, in both directions.** Bopomofo, Wade-Giles,
|
|
417
|
-
Yale, Gwoyeu Romatzyh and IPA at the syllable level, plus hanzi → any of them
|
|
418
|
-
end to end via `convert --system` and `convertToWadeGiles`. Checked against
|
|
419
|
-
417 rows of an outside syllabary in every system, which is 3,336 cells.
|
|
420
|
-
- **Reading ambiguous Wade-Giles.** `readWadeGilesLoosely` allows for the
|
|
421
|
-
apostrophes and diacritics real texts drop, and `splitWadeGiles` puts back the
|
|
422
|
-
hyphens they lose. Measured: 52.07% of written syllables lose their identity
|
|
423
|
-
without their marks, and taking the first candidate recovers 79.05%.
|
|
424
|
-
- **Numbers read aloud** (`src/numerals/`, the `number` command): counting and
|
|
425
|
-
spelling out, 两 against 二, decimals, percentages, fractions, `yāo`, and
|
|
426
|
-
times. `convert` reads the digits it meets and takes the style from what
|
|
427
|
-
follows them.
|
|
428
|
-
- **Orthography rules.** The 重叠 hyphen for AABB and repeated words, the 成语
|
|
429
|
-
hyphen from a curated list of 117, 老王 → `Lǎo Wáng`, and GB/T 16159 5.1 in
|
|
430
|
-
full, so 毛泽东 is `Máo Zédōng` and 北京大学 is `Běijīng Dàxué`, on boundaries
|
|
431
|
-
CC-CEDICT's own capitalisation states.
|
|
432
|
-
- **Typed rule overrides on the lattice** (`READING_RULES`), with the modal 得
|
|
433
|
-
and attested 儿化 as the first two.
|
|
434
|
-
- **Tone colour in the terminal**, in MDBG's palette, on every command that
|
|
435
|
-
writes a syllable.
|
|
436
|
-
|
|
437
|
-
### Fixed since 0.1.0-beta.0
|
|
438
|
-
|
|
439
|
-
- **一 sandhi is about the 一 that counts.** 十一月 is `shíyīyuè` and 第一次 is
|
|
440
|
-
`dìyīcì`; the citation tone survives a final digit and an ordinal. 561
|
|
441
|
-
conversions change over 88,866 lines, 520 of them right.
|
|
442
|
-
- **A colon between digits is a time**, not an identifier: 6:30 is
|
|
443
|
-
`liù diǎn sānshí fēn`.
|
|
444
|
-
- **The documented proper-noun mechanism was wrong.** The capitals page
|
|
445
|
-
described a 500-entry surname list that has never existed; what produces
|
|
446
|
-
`Lǐ Huá` is two single-character dictionary entries each flagged a proper
|
|
447
|
-
noun.
|
|
448
|
-
|
|
449
|
-
### Changed
|
|
450
|
-
|
|
451
|
-
- **`engines` is now `>=22.0.0`**, down from `>=24.0.0`. The suite and the
|
|
452
|
-
packaged tarball are both exercised on Node 22 and 24 in CI.
|
|
453
|
-
- **No more `beta` dist-tag.** `pnpm add @kensio/pinyinjs` finds it.
|
|
454
|
-
- `src/romanization/` is `src/transcription/`, since bopomofo has a script of
|
|
455
|
-
its own and IPA is a transcription rather than a spelling. The published docs
|
|
456
|
-
path keeps the older name.
|
|
457
|
-
- The build cleans `dist/` before compiling, and `pnpm pack:check` asserts the
|
|
458
|
-
tarball's contents. The beta tarball shipped 24 stale files from a directory
|
|
459
|
-
that had been renamed away.
|
|
460
|
-
|
|
461
|
-
### Accuracy at 1.0.0
|
|
462
|
-
|
|
463
|
-
Over the 126-case gold corpus, which is committed to the repository rather than
|
|
464
|
-
to the published package, and scored by `pnpm accuracy`:
|
|
465
|
-
|
|
466
|
-
| | lattice | greedy baseline |
|
|
467
|
-
| ---------------- | --------: | --------------: |
|
|
468
|
-
| exact match | **97.6%** | 88.9% |
|
|
469
|
-
| reading accuracy | 99.7% | 98.4% |
|
|
470
|
-
| spacing (F1) | **99.8%** | 96.5% |
|
|
471
|
-
|
|
472
|
-
Every figure in that table is asserted against the scorer by
|
|
473
|
-
`src/changelog.test.ts`, because a number nothing executes goes stale, which is
|
|
474
|
-
what happened to this project's README table across three releases.
|
|
475
|
-
|
|
476
|
-
`pnpm polyphones` reports 89.04% for the lattice against greedy's 88.82% over
|
|
477
|
-
CPP's 20,139 hand-labelled polyphones. That corpus is fetched rather than
|
|
478
|
-
committed, so unlike the table above it cannot be asserted here, and it is
|
|
479
|
-
reported rather than guarded.
|
|
480
|
-
|
|
481
|
-
## 0.1.0-beta.0
|
|
482
|
-
|
|
483
|
-
First published release: the lattice decoder, the tiered dictionaries, the
|
|
484
|
-
syllable layer, sandhi, GB/T 16159 spacing and capitals, HTML output and the
|
|
485
|
-
`pinyinjs` command.
|