@kensio/pinyinjs 1.7.4 → 1.7.6

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 (732) hide show
  1. package/README.md +128 -123
  2. package/data/full.entries +2595 -2595
  3. package/data/manifest.json +5 -5
  4. package/data/script.map +66 -3
  5. package/dist/accuracy/score-case.d.ts +23 -0
  6. package/dist/accuracy/score-case.d.ts.map +1 -0
  7. package/dist/accuracy/score-case.js +63 -0
  8. package/dist/accuracy/score-case.js.map +1 -0
  9. package/dist/accuracy/score.d.ts +1 -8
  10. package/dist/accuracy/score.d.ts.map +1 -1
  11. package/dist/accuracy/score.js +1 -55
  12. package/dist/accuracy/score.js.map +1 -1
  13. package/dist/cli/arguments.d.ts +4 -290
  14. package/dist/cli/arguments.d.ts.map +1 -1
  15. package/dist/cli/arguments.js +5 -357
  16. package/dist/cli/arguments.js.map +1 -1
  17. package/dist/cli/check-command.d.ts +9 -0
  18. package/dist/cli/check-command.d.ts.map +1 -0
  19. package/dist/cli/check-command.js +95 -0
  20. package/dist/cli/check-command.js.map +1 -0
  21. package/dist/cli/cli-input.d.ts +49 -0
  22. package/dist/cli/cli-input.d.ts.map +1 -0
  23. package/dist/cli/cli-input.js +31 -0
  24. package/dist/cli/cli-input.js.map +1 -0
  25. package/dist/cli/command.d.ts +97 -0
  26. package/dist/cli/command.d.ts.map +1 -0
  27. package/dist/cli/command.js +40 -0
  28. package/dist/cli/command.js.map +1 -0
  29. package/dist/cli/commands.d.ts +7 -110
  30. package/dist/cli/commands.d.ts.map +1 -1
  31. package/dist/cli/commands.js +14 -991
  32. package/dist/cli/commands.js.map +1 -1
  33. package/dist/cli/convert-command.d.ts +6 -0
  34. package/dist/cli/convert-command.d.ts.map +1 -0
  35. package/dist/cli/convert-command.js +52 -0
  36. package/dist/cli/convert-command.js.map +1 -0
  37. package/dist/cli/environment.d.ts +1 -1
  38. package/dist/cli/environment.d.ts.map +1 -1
  39. package/dist/cli/explain-command.d.ts +6 -0
  40. package/dist/cli/explain-command.d.ts.map +1 -0
  41. package/dist/cli/explain-command.js +40 -0
  42. package/dist/cli/explain-command.js.map +1 -0
  43. package/dist/cli/explain-syllable.d.ts +10 -0
  44. package/dist/cli/explain-syllable.d.ts.map +1 -0
  45. package/dist/cli/explain-syllable.js +70 -0
  46. package/dist/cli/explain-syllable.js.map +1 -0
  47. package/dist/cli/flag-help.d.ts +18 -0
  48. package/dist/cli/flag-help.d.ts.map +1 -0
  49. package/dist/cli/flag-help.js +78 -0
  50. package/dist/cli/flag-help.js.map +1 -0
  51. package/dist/cli/flag-lists.d.ts +49 -0
  52. package/dist/cli/flag-lists.d.ts.map +1 -0
  53. package/dist/cli/flag-lists.js +58 -0
  54. package/dist/cli/flag-lists.js.map +1 -0
  55. package/dist/cli/flag-values.d.ts +44 -0
  56. package/dist/cli/flag-values.d.ts.map +1 -0
  57. package/dist/cli/flag-values.js +56 -0
  58. package/dist/cli/flag-values.js.map +1 -0
  59. package/dist/cli/flags.d.ts +193 -0
  60. package/dist/cli/flags.d.ts.map +1 -0
  61. package/dist/cli/flags.js +133 -0
  62. package/dist/cli/flags.js.map +1 -0
  63. package/dist/cli/format-options.d.ts +29 -0
  64. package/dist/cli/format-options.d.ts.map +1 -0
  65. package/dist/cli/format-options.js +72 -0
  66. package/dist/cli/format-options.js.map +1 -0
  67. package/dist/cli/global-help.d.ts +23 -0
  68. package/dist/cli/global-help.d.ts.map +1 -0
  69. package/dist/cli/global-help.js +40 -0
  70. package/dist/cli/global-help.js.map +1 -0
  71. package/dist/cli/help.d.ts +1 -1
  72. package/dist/cli/help.d.ts.map +1 -1
  73. package/dist/cli/help.js +5 -99
  74. package/dist/cli/help.js.map +1 -1
  75. package/dist/cli/html-commands.d.ts +13 -0
  76. package/dist/cli/html-commands.d.ts.map +1 -0
  77. package/dist/cli/html-commands.js +49 -0
  78. package/dist/cli/html-commands.js.map +1 -0
  79. package/dist/cli/info-command.d.ts +7 -0
  80. package/dist/cli/info-command.d.ts.map +1 -0
  81. package/dist/cli/info-command.js +39 -0
  82. package/dist/cli/info-command.js.map +1 -0
  83. package/dist/cli/lookup-commands.d.ts +10 -0
  84. package/dist/cli/lookup-commands.d.ts.map +1 -0
  85. package/dist/cli/lookup-commands.js +101 -0
  86. package/dist/cli/lookup-commands.js.map +1 -0
  87. package/dist/cli/match-command.d.ts +11 -0
  88. package/dist/cli/match-command.d.ts.map +1 -0
  89. package/dist/cli/match-command.js +76 -0
  90. package/dist/cli/match-command.js.map +1 -0
  91. package/dist/cli/number-command.d.ts +12 -0
  92. package/dist/cli/number-command.d.ts.map +1 -0
  93. package/dist/cli/number-command.js +89 -0
  94. package/dist/cli/number-command.js.map +1 -0
  95. package/dist/cli/options.d.ts +30 -0
  96. package/dist/cli/options.d.ts.map +1 -0
  97. package/dist/cli/options.js +54 -0
  98. package/dist/cli/options.js.map +1 -0
  99. package/dist/cli/run-command.d.ts +24 -0
  100. package/dist/cli/run-command.d.ts.map +1 -0
  101. package/dist/cli/run-command.js +40 -0
  102. package/dist/cli/run-command.js.map +1 -0
  103. package/dist/cli/run.d.ts +4 -42
  104. package/dist/cli/run.d.ts.map +1 -1
  105. package/dist/cli/run.js +6 -61
  106. package/dist/cli/run.js.map +1 -1
  107. package/dist/cli/script-command.d.ts +10 -0
  108. package/dist/cli/script-command.d.ts.map +1 -0
  109. package/dist/cli/script-command.js +58 -0
  110. package/dist/cli/script-command.js.map +1 -0
  111. package/dist/cli/segment-command.d.ts +11 -0
  112. package/dist/cli/segment-command.d.ts.map +1 -0
  113. package/dist/cli/segment-command.js +53 -0
  114. package/dist/cli/segment-command.js.map +1 -0
  115. package/dist/cli/slug-command.d.ts +10 -0
  116. package/dist/cli/slug-command.d.ts.map +1 -0
  117. package/dist/cli/slug-command.js +28 -0
  118. package/dist/cli/slug-command.js.map +1 -0
  119. package/dist/cli/syllable-command.d.ts +14 -0
  120. package/dist/cli/syllable-command.d.ts.map +1 -0
  121. package/dist/cli/syllable-command.js +82 -0
  122. package/dist/cli/syllable-command.js.map +1 -0
  123. package/dist/cli/system-table.d.ts +12 -0
  124. package/dist/cli/system-table.d.ts.map +1 -0
  125. package/dist/cli/system-table.js +48 -0
  126. package/dist/cli/system-table.js.map +1 -0
  127. package/dist/cli/systems.d.ts +57 -0
  128. package/dist/cli/systems.d.ts.map +1 -0
  129. package/dist/cli/systems.js +27 -0
  130. package/dist/cli/systems.js.map +1 -0
  131. package/dist/cli/transcribe-command.d.ts +18 -0
  132. package/dist/cli/transcribe-command.d.ts.map +1 -0
  133. package/dist/cli/transcribe-command.js +86 -0
  134. package/dist/cli/transcribe-command.js.map +1 -0
  135. package/dist/cli/transcribe-reading.d.ts +15 -0
  136. package/dist/cli/transcribe-reading.d.ts.map +1 -0
  137. package/dist/cli/transcribe-reading.js +90 -0
  138. package/dist/cli/transcribe-reading.js.map +1 -0
  139. package/dist/cli/transcribe-rows.d.ts +26 -0
  140. package/dist/cli/transcribe-rows.d.ts.map +1 -0
  141. package/dist/cli/transcribe-rows.js +30 -0
  142. package/dist/cli/transcribe-rows.js.map +1 -0
  143. package/dist/cli/usage-error.d.ts +9 -0
  144. package/dist/cli/usage-error.d.ts.map +1 -0
  145. package/dist/cli/usage-error.js +9 -0
  146. package/dist/cli/usage-error.js.map +1 -0
  147. package/dist/decode/alternatives.d.ts +16 -0
  148. package/dist/decode/alternatives.d.ts.map +1 -0
  149. package/dist/decode/alternatives.js +31 -0
  150. package/dist/decode/alternatives.js.map +1 -0
  151. package/dist/decode/chang-context.d.ts +27 -0
  152. package/dist/decode/chang-context.d.ts.map +1 -0
  153. package/dist/decode/chang-context.js +66 -0
  154. package/dist/decode/chang-context.js.map +1 -0
  155. package/dist/decode/chang-rule.d.ts +37 -0
  156. package/dist/decode/chang-rule.d.ts.map +1 -0
  157. package/dist/decode/chang-rule.js +169 -0
  158. package/dist/decode/chang-rule.js.map +1 -0
  159. package/dist/decode/confidence.d.ts +11 -3
  160. package/dist/decode/confidence.d.ts.map +1 -1
  161. package/dist/decode/confidence.js +14 -121
  162. package/dist/decode/confidence.js.map +1 -1
  163. package/dist/decode/convert-options.d.ts +116 -0
  164. package/dist/decode/convert-options.d.ts.map +1 -0
  165. package/dist/decode/convert-options.js +2 -0
  166. package/dist/decode/convert-options.js.map +1 -0
  167. package/dist/decode/convert-pipeline.d.ts +18 -0
  168. package/dist/decode/convert-pipeline.d.ts.map +1 -0
  169. package/dist/decode/convert-pipeline.js +67 -0
  170. package/dist/decode/convert-pipeline.js.map +1 -0
  171. package/dist/decode/convert.d.ts +9 -118
  172. package/dist/decode/convert.d.ts.map +1 -1
  173. package/dist/decode/convert.js +5 -453
  174. package/dist/decode/convert.js.map +1 -1
  175. package/dist/decode/de-rule.d.ts +54 -0
  176. package/dist/decode/de-rule.d.ts.map +1 -0
  177. package/dist/decode/de-rule.js +113 -0
  178. package/dist/decode/de-rule.js.map +1 -0
  179. package/dist/decode/decode.d.ts +2 -15
  180. package/dist/decode/decode.d.ts.map +1 -1
  181. package/dist/decode/decode.js +2 -121
  182. package/dist/decode/decode.js.map +1 -1
  183. package/dist/decode/decoders.d.ts +32 -0
  184. package/dist/decode/decoders.d.ts.map +1 -0
  185. package/dist/decode/decoders.js +29 -0
  186. package/dist/decode/decoders.js.map +1 -0
  187. package/dist/decode/edge-context.d.ts +38 -0
  188. package/dist/decode/edge-context.d.ts.map +1 -0
  189. package/dist/decode/edge-context.js +57 -0
  190. package/dist/decode/edge-context.js.map +1 -0
  191. package/dist/decode/hint-lattice.d.ts +45 -0
  192. package/dist/decode/hint-lattice.d.ts.map +1 -0
  193. package/dist/decode/hint-lattice.js +154 -0
  194. package/dist/decode/hint-lattice.js.map +1 -0
  195. package/dist/decode/hints.d.ts +2 -45
  196. package/dist/decode/hints.d.ts.map +1 -1
  197. package/dist/decode/hints.js +1 -139
  198. package/dist/decode/hints.js.map +1 -1
  199. package/dist/decode/jiao-rule.d.ts +64 -0
  200. package/dist/decode/jiao-rule.d.ts.map +1 -0
  201. package/dist/decode/jiao-rule.js +115 -0
  202. package/dist/decode/jiao-rule.js.map +1 -0
  203. package/dist/decode/lattice-costs.d.ts +55 -0
  204. package/dist/decode/lattice-costs.d.ts.map +1 -0
  205. package/dist/decode/lattice-costs.js +90 -0
  206. package/dist/decode/lattice-costs.js.map +1 -0
  207. package/dist/decode/lattice-edges.d.ts +29 -0
  208. package/dist/decode/lattice-edges.d.ts.map +1 -0
  209. package/dist/decode/lattice-edges.js +78 -0
  210. package/dist/decode/lattice-edges.js.map +1 -0
  211. package/dist/decode/lattice-slice.d.ts +37 -0
  212. package/dist/decode/lattice-slice.d.ts.map +1 -0
  213. package/dist/decode/lattice-slice.js +43 -0
  214. package/dist/decode/lattice-slice.js.map +1 -0
  215. package/dist/decode/lattice-types.d.ts +101 -0
  216. package/dist/decode/lattice-types.d.ts.map +1 -0
  217. package/dist/decode/lattice-types.js +63 -0
  218. package/dist/decode/lattice-types.js.map +1 -0
  219. package/dist/decode/lattice.d.ts +2 -59
  220. package/dist/decode/lattice.d.ts.map +1 -1
  221. package/dist/decode/lattice.js +2 -118
  222. package/dist/decode/lattice.js.map +1 -1
  223. package/dist/decode/number-pieces.d.ts +62 -0
  224. package/dist/decode/number-pieces.d.ts.map +1 -0
  225. package/dist/decode/number-pieces.js +106 -0
  226. package/dist/decode/number-pieces.js.map +1 -0
  227. package/dist/decode/numbers.d.ts +53 -0
  228. package/dist/decode/numbers.d.ts.map +1 -0
  229. package/dist/decode/numbers.js +69 -0
  230. package/dist/decode/numbers.js.map +1 -0
  231. package/dist/decode/pieces.d.ts +78 -0
  232. package/dist/decode/pieces.d.ts.map +1 -0
  233. package/dist/decode/pieces.js +136 -0
  234. package/dist/decode/pieces.js.map +1 -0
  235. package/dist/decode/polyphone-rules.d.ts +11 -0
  236. package/dist/decode/polyphone-rules.d.ts.map +1 -0
  237. package/dist/decode/polyphone-rules.js +11 -0
  238. package/dist/decode/polyphone-rules.js.map +1 -0
  239. package/dist/decode/reading-rules.d.ts +3 -126
  240. package/dist/decode/reading-rules.d.ts.map +1 -1
  241. package/dist/decode/reading-rules.js +8 -434
  242. package/dist/decode/reading-rules.js.map +1 -1
  243. package/dist/decode/rules.d.ts +1 -17
  244. package/dist/decode/rules.d.ts.map +1 -1
  245. package/dist/decode/rules.js +1 -43
  246. package/dist/decode/rules.js.map +1 -1
  247. package/dist/decode/run-lattice.d.ts +52 -0
  248. package/dist/decode/run-lattice.d.ts.map +1 -0
  249. package/dist/decode/run-lattice.js +91 -0
  250. package/dist/decode/run-lattice.js.map +1 -0
  251. package/dist/decode/run-words.d.ts +17 -0
  252. package/dist/decode/run-words.d.ts.map +1 -0
  253. package/dist/decode/run-words.js +29 -0
  254. package/dist/decode/run-words.js.map +1 -0
  255. package/dist/decode/sandhi-input.d.ts +30 -0
  256. package/dist/decode/sandhi-input.d.ts.map +1 -0
  257. package/dist/decode/sandhi-input.js +35 -0
  258. package/dist/decode/sandhi-input.js.map +1 -0
  259. package/dist/decode/sandhi-tones.d.ts +97 -0
  260. package/dist/decode/sandhi-tones.d.ts.map +1 -0
  261. package/dist/decode/sandhi-tones.js +139 -0
  262. package/dist/decode/sandhi-tones.js.map +1 -0
  263. package/dist/decode/sandhi.d.ts +10 -7
  264. package/dist/decode/sandhi.d.ts.map +1 -1
  265. package/dist/decode/sandhi.js +11 -88
  266. package/dist/decode/sandhi.js.map +1 -1
  267. package/dist/decode/script-types.d.ts +76 -0
  268. package/dist/decode/script-types.d.ts.map +1 -0
  269. package/dist/decode/script-types.js +35 -0
  270. package/dist/decode/script-types.js.map +1 -0
  271. package/dist/decode/script-words.d.ts +32 -0
  272. package/dist/decode/script-words.d.ts.map +1 -0
  273. package/dist/decode/script-words.js +77 -0
  274. package/dist/decode/script-words.js.map +1 -0
  275. package/dist/decode/script.d.ts +3 -73
  276. package/dist/decode/script.d.ts.map +1 -1
  277. package/dist/decode/script.js +3 -109
  278. package/dist/decode/script.js.map +1 -1
  279. package/dist/decode/tan-rule.d.ts +68 -0
  280. package/dist/decode/tan-rule.d.ts.map +1 -0
  281. package/dist/decode/tan-rule.js +131 -0
  282. package/dist/decode/tan-rule.js.map +1 -0
  283. package/dist/decode/write-run.d.ts +21 -0
  284. package/dist/decode/write-run.d.ts.map +1 -0
  285. package/dist/decode/write-run.js +42 -0
  286. package/dist/decode/write-run.js.map +1 -0
  287. package/dist/dictionary/artifact-claims.d.ts +25 -0
  288. package/dist/dictionary/artifact-claims.d.ts.map +1 -0
  289. package/dist/dictionary/artifact-claims.js +47 -0
  290. package/dist/dictionary/artifact-claims.js.map +1 -0
  291. package/dist/dictionary/artifact-format.d.ts +86 -0
  292. package/dist/dictionary/artifact-format.d.ts.map +1 -0
  293. package/dist/dictionary/artifact-format.js +91 -0
  294. package/dist/dictionary/artifact-format.js.map +1 -0
  295. package/dist/dictionary/artifact-read.d.ts +34 -0
  296. package/dist/dictionary/artifact-read.d.ts.map +1 -0
  297. package/dist/dictionary/artifact-read.js +114 -0
  298. package/dist/dictionary/artifact-read.js.map +1 -0
  299. package/dist/dictionary/artifact.d.ts +4 -63
  300. package/dist/dictionary/artifact.d.ts.map +1 -1
  301. package/dist/dictionary/artifact.js +12 -229
  302. package/dist/dictionary/artifact.js.map +1 -1
  303. package/dist/dictionary/assertions.d.ts +5 -57
  304. package/dist/dictionary/assertions.d.ts.map +1 -1
  305. package/dist/dictionary/assertions.js +4 -317
  306. package/dist/dictionary/assertions.js.map +1 -1
  307. package/dist/dictionary/build-assertions.d.ts +12 -0
  308. package/dist/dictionary/build-assertions.d.ts.map +1 -0
  309. package/dist/dictionary/build-assertions.js +13 -0
  310. package/dist/dictionary/build-assertions.js.map +1 -0
  311. package/dist/dictionary/built-dictionary.d.ts +46 -0
  312. package/dist/dictionary/built-dictionary.d.ts.map +1 -0
  313. package/dist/dictionary/built-dictionary.js +97 -0
  314. package/dist/dictionary/built-dictionary.js.map +1 -0
  315. package/dist/dictionary/cedict-senses.d.ts +87 -0
  316. package/dist/dictionary/cedict-senses.d.ts.map +1 -0
  317. package/dist/dictionary/cedict-senses.js +126 -0
  318. package/dist/dictionary/cedict-senses.js.map +1 -0
  319. package/dist/dictionary/character-defaults.d.ts +26 -0
  320. package/dist/dictionary/character-defaults.d.ts.map +1 -0
  321. package/dist/dictionary/character-defaults.js +67 -0
  322. package/dist/dictionary/character-defaults.js.map +1 -0
  323. package/dist/dictionary/character-readings.d.ts +10 -0
  324. package/dist/dictionary/character-readings.d.ts.map +1 -0
  325. package/dist/dictionary/character-readings.js +25 -0
  326. package/dist/dictionary/character-readings.js.map +1 -0
  327. package/dist/dictionary/constituent-repair.d.ts +36 -0
  328. package/dist/dictionary/constituent-repair.d.ts.map +1 -0
  329. package/dist/dictionary/constituent-repair.js +117 -0
  330. package/dist/dictionary/constituent-repair.js.map +1 -0
  331. package/dist/dictionary/dictionary-entry.d.ts +37 -0
  332. package/dist/dictionary/dictionary-entry.d.ts.map +1 -0
  333. package/dist/dictionary/dictionary-entry.js +41 -0
  334. package/dist/dictionary/dictionary-entry.js.map +1 -0
  335. package/dist/dictionary/dictionary-readings.d.ts +56 -0
  336. package/dist/dictionary/dictionary-readings.d.ts.map +1 -0
  337. package/dist/dictionary/dictionary-readings.js +93 -0
  338. package/dist/dictionary/dictionary-readings.js.map +1 -0
  339. package/dist/dictionary/dictionary.d.ts +6 -60
  340. package/dist/dictionary/dictionary.d.ts.map +1 -1
  341. package/dist/dictionary/dictionary.js +9 -169
  342. package/dist/dictionary/dictionary.js.map +1 -1
  343. package/dist/dictionary/entry-invariants.d.ts +3 -0
  344. package/dist/dictionary/entry-invariants.d.ts.map +1 -0
  345. package/dist/dictionary/entry-invariants.js +67 -0
  346. package/dist/dictionary/entry-invariants.js.map +1 -0
  347. package/dist/dictionary/entry-lines.d.ts +35 -0
  348. package/dist/dictionary/entry-lines.d.ts.map +1 -0
  349. package/dist/dictionary/entry-lines.js +70 -0
  350. package/dist/dictionary/entry-lines.js.map +1 -0
  351. package/dist/dictionary/erhua-repair.d.ts +26 -0
  352. package/dist/dictionary/erhua-repair.d.ts.map +1 -0
  353. package/dist/dictionary/erhua-repair.js +49 -0
  354. package/dist/dictionary/erhua-repair.js.map +1 -0
  355. package/dist/dictionary/frequency-tones.d.ts +74 -0
  356. package/dist/dictionary/frequency-tones.d.ts.map +1 -0
  357. package/dist/dictionary/frequency-tones.js +128 -0
  358. package/dist/dictionary/frequency-tones.js.map +1 -0
  359. package/dist/dictionary/inventory-invariants.d.ts +3 -0
  360. package/dist/dictionary/inventory-invariants.d.ts.map +1 -0
  361. package/dist/dictionary/inventory-invariants.js +54 -0
  362. package/dist/dictionary/inventory-invariants.js.map +1 -0
  363. package/dist/dictionary/locale-candidates.d.ts +40 -0
  364. package/dist/dictionary/locale-candidates.d.ts.map +1 -0
  365. package/dist/dictionary/locale-candidates.js +77 -0
  366. package/dist/dictionary/locale-candidates.js.map +1 -0
  367. package/dist/dictionary/locale-segments.d.ts +47 -0
  368. package/dist/dictionary/locale-segments.d.ts.map +1 -0
  369. package/dist/dictionary/locale-segments.js +141 -0
  370. package/dist/dictionary/locale-segments.js.map +1 -0
  371. package/dist/dictionary/locale.d.ts +1 -21
  372. package/dist/dictionary/locale.d.ts.map +1 -1
  373. package/dist/dictionary/locale.js +9 -198
  374. package/dist/dictionary/locale.js.map +1 -1
  375. package/dist/dictionary/merge-types.d.ts +127 -0
  376. package/dist/dictionary/merge-types.d.ts.map +1 -0
  377. package/dist/dictionary/merge-types.js +35 -0
  378. package/dist/dictionary/merge-types.js.map +1 -0
  379. package/dist/dictionary/merge-walk.d.ts +27 -0
  380. package/dist/dictionary/merge-walk.d.ts.map +1 -0
  381. package/dist/dictionary/merge-walk.js +49 -0
  382. package/dist/dictionary/merge-walk.js.map +1 -0
  383. package/dist/dictionary/merge-word.d.ts +7 -0
  384. package/dist/dictionary/merge-word.d.ts.map +1 -0
  385. package/dist/dictionary/merge-word.js +91 -0
  386. package/dist/dictionary/merge-word.js.map +1 -0
  387. package/dist/dictionary/merge.d.ts +5 -62
  388. package/dist/dictionary/merge.d.ts.map +1 -1
  389. package/dist/dictionary/merge.js +32 -725
  390. package/dist/dictionary/merge.js.map +1 -1
  391. package/dist/dictionary/proper-noun.d.ts +28 -0
  392. package/dist/dictionary/proper-noun.d.ts.map +1 -0
  393. package/dist/dictionary/proper-noun.js +43 -0
  394. package/dist/dictionary/proper-noun.js.map +1 -0
  395. package/dist/dictionary/reading-agreement.d.ts +71 -0
  396. package/dist/dictionary/reading-agreement.d.ts.map +1 -0
  397. package/dist/dictionary/reading-agreement.js +156 -0
  398. package/dist/dictionary/reading-agreement.js.map +1 -0
  399. package/dist/dictionary/script-conversion.d.ts +28 -0
  400. package/dist/dictionary/script-conversion.d.ts.map +1 -0
  401. package/dist/dictionary/script-conversion.js +58 -0
  402. package/dist/dictionary/script-conversion.js.map +1 -0
  403. package/dist/dictionary/script-pairings.d.ts +74 -0
  404. package/dist/dictionary/script-pairings.d.ts.map +1 -0
  405. package/dist/dictionary/script-pairings.js +120 -0
  406. package/dist/dictionary/script-pairings.js.map +1 -0
  407. package/dist/dictionary/script-tables.d.ts.map +1 -1
  408. package/dist/dictionary/script-tables.js +2 -165
  409. package/dist/dictionary/script-tables.js.map +1 -1
  410. package/dist/dictionary/taiwan-reading.d.ts +8 -0
  411. package/dist/dictionary/taiwan-reading.d.ts.map +1 -0
  412. package/dist/dictionary/taiwan-reading.js +38 -0
  413. package/dist/dictionary/taiwan-reading.js.map +1 -0
  414. package/dist/dictionary/tone-invariants.d.ts +3 -0
  415. package/dist/dictionary/tone-invariants.d.ts.map +1 -0
  416. package/dist/dictionary/tone-invariants.js +64 -0
  417. package/dist/dictionary/tone-invariants.js.map +1 -0
  418. package/dist/dictionary/traditional-form.d.ts +21 -0
  419. package/dist/dictionary/traditional-form.d.ts.map +1 -0
  420. package/dist/dictionary/traditional-form.js +59 -0
  421. package/dist/dictionary/traditional-form.js.map +1 -0
  422. package/dist/dictionary/traditional-ranking.d.ts +22 -0
  423. package/dist/dictionary/traditional-ranking.d.ts.map +1 -0
  424. package/dist/dictionary/traditional-ranking.js +74 -0
  425. package/dist/dictionary/traditional-ranking.js.map +1 -0
  426. package/dist/dictionary/traditional-table.d.ts +51 -0
  427. package/dist/dictionary/traditional-table.d.ts.map +1 -0
  428. package/dist/dictionary/traditional-table.js +98 -0
  429. package/dist/dictionary/traditional-table.js.map +1 -0
  430. package/dist/dictionary/traditional.d.ts +3 -56
  431. package/dist/dictionary/traditional.d.ts.map +1 -1
  432. package/dist/dictionary/traditional.js +3 -186
  433. package/dist/dictionary/traditional.js.map +1 -1
  434. package/dist/dictionary/variant-counts.d.ts +39 -0
  435. package/dist/dictionary/variant-counts.d.ts.map +1 -0
  436. package/dist/dictionary/variant-counts.js +38 -0
  437. package/dist/dictionary/variant-counts.js.map +1 -0
  438. package/dist/dictionary/word-reading.d.ts +26 -0
  439. package/dist/dictionary/word-reading.d.ts.map +1 -0
  440. package/dist/dictionary/word-reading.js +76 -0
  441. package/dist/dictionary/word-reading.js.map +1 -0
  442. package/dist/dictionary/word-readings.d.ts +15 -0
  443. package/dist/dictionary/word-readings.d.ts.map +1 -0
  444. package/dist/dictionary/word-readings.js +41 -0
  445. package/dist/dictionary/word-readings.js.map +1 -0
  446. package/dist/format/annotate.d.ts +90 -0
  447. package/dist/format/annotate.d.ts.map +1 -0
  448. package/dist/format/annotate.js +168 -0
  449. package/dist/format/annotate.js.map +1 -0
  450. package/dist/format/html.d.ts +15 -46
  451. package/dist/format/html.d.ts.map +1 -1
  452. package/dist/format/html.js +3 -162
  453. package/dist/format/html.js.map +1 -1
  454. package/dist/format/slug-hash.d.ts +51 -0
  455. package/dist/format/slug-hash.d.ts.map +1 -0
  456. package/dist/format/slug-hash.js +74 -0
  457. package/dist/format/slug-hash.js.map +1 -0
  458. package/dist/format/slug-options.d.ts +98 -0
  459. package/dist/format/slug-options.d.ts.map +1 -0
  460. package/dist/format/slug-options.js +2 -0
  461. package/dist/format/slug-options.js.map +1 -0
  462. package/dist/format/slug-words.d.ts +27 -0
  463. package/dist/format/slug-words.d.ts.map +1 -0
  464. package/dist/format/slug-words.js +0 -0
  465. package/dist/format/slug-words.js.map +1 -0
  466. package/dist/format/slug.d.ts +3 -128
  467. package/dist/format/slug.d.ts.map +1 -1
  468. package/dist/format/slug.js +0 -0
  469. package/dist/format/slug.js.map +1 -1
  470. package/dist/grade/check-readings.d.ts +41 -0
  471. package/dist/grade/check-readings.d.ts.map +1 -0
  472. package/dist/grade/check-readings.js +36 -0
  473. package/dist/grade/check-readings.js.map +1 -0
  474. package/dist/grade/check.d.ts +4 -4
  475. package/dist/grade/check.d.ts.map +1 -1
  476. package/dist/grade/check.js +5 -270
  477. package/dist/grade/check.js.map +1 -1
  478. package/dist/grade/pair-syllables.d.ts +48 -0
  479. package/dist/grade/pair-syllables.d.ts.map +1 -0
  480. package/dist/grade/pair-syllables.js +71 -0
  481. package/dist/grade/pair-syllables.js.map +1 -0
  482. package/dist/grade/reading-syllables.d.ts +62 -0
  483. package/dist/grade/reading-syllables.d.ts.map +1 -0
  484. package/dist/grade/reading-syllables.js +58 -0
  485. package/dist/grade/reading-syllables.js.map +1 -0
  486. package/dist/grade/reading-tolerance.d.ts +72 -0
  487. package/dist/grade/reading-tolerance.d.ts.map +1 -0
  488. package/dist/grade/reading-tolerance.js +107 -0
  489. package/dist/grade/reading-tolerance.js.map +1 -0
  490. package/dist/grade/typed-reading.d.ts +28 -0
  491. package/dist/grade/typed-reading.d.ts.map +1 -0
  492. package/dist/grade/typed-reading.js +36 -0
  493. package/dist/grade/typed-reading.js.map +1 -0
  494. package/dist/index.d.ts +1 -1
  495. package/dist/index.d.ts.map +1 -1
  496. package/dist/index.js +1 -1
  497. package/dist/index.js.map +1 -1
  498. package/dist/numerals/numeral-parse.d.ts +32 -0
  499. package/dist/numerals/numeral-parse.d.ts.map +1 -0
  500. package/dist/numerals/numeral-parse.js +44 -0
  501. package/dist/numerals/numeral-parse.js.map +1 -0
  502. package/dist/numerals/numeral-shapes.d.ts +89 -0
  503. package/dist/numerals/numeral-shapes.d.ts.map +1 -0
  504. package/dist/numerals/numeral-shapes.js +99 -0
  505. package/dist/numerals/numeral-shapes.js.map +1 -0
  506. package/dist/numerals/numerals.d.ts.map +1 -1
  507. package/dist/numerals/numerals.js +2 -36
  508. package/dist/numerals/numerals.js.map +1 -1
  509. package/dist/numerals/read-numeral.d.ts +76 -0
  510. package/dist/numerals/read-numeral.d.ts.map +1 -0
  511. package/dist/numerals/read-numeral.js +88 -0
  512. package/dist/numerals/read-numeral.js.map +1 -0
  513. package/dist/numerals/text.d.ts +3 -37
  514. package/dist/numerals/text.d.ts.map +1 -1
  515. package/dist/numerals/text.js +3 -254
  516. package/dist/numerals/text.js.map +1 -1
  517. package/dist/numerals/time.d.ts +34 -0
  518. package/dist/numerals/time.d.ts.map +1 -0
  519. package/dist/numerals/time.js +93 -0
  520. package/dist/numerals/time.js.map +1 -0
  521. package/dist/orthography/address-grouping.d.ts +34 -0
  522. package/dist/orthography/address-grouping.d.ts.map +1 -0
  523. package/dist/orthography/address-grouping.js +52 -0
  524. package/dist/orthography/address-grouping.js.map +1 -0
  525. package/dist/orthography/grouping.d.ts +3 -87
  526. package/dist/orthography/grouping.d.ts.map +1 -1
  527. package/dist/orthography/grouping.js +4 -270
  528. package/dist/orthography/grouping.js.map +1 -1
  529. package/dist/orthography/place-grouping.d.ts +39 -0
  530. package/dist/orthography/place-grouping.d.ts.map +1 -0
  531. package/dist/orthography/place-grouping.js +83 -0
  532. package/dist/orthography/place-grouping.js.map +1 -0
  533. package/dist/orthography/word-grouping.d.ts +48 -0
  534. package/dist/orthography/word-grouping.d.ts.map +1 -0
  535. package/dist/orthography/word-grouping.js +147 -0
  536. package/dist/orthography/word-grouping.js.map +1 -0
  537. package/dist/script/conversion-format.d.ts +22 -0
  538. package/dist/script/conversion-format.d.ts.map +1 -0
  539. package/dist/script/conversion-format.js +22 -0
  540. package/dist/script/conversion-format.js.map +1 -0
  541. package/dist/script/conversion-read.d.ts +9 -0
  542. package/dist/script/conversion-read.d.ts.map +1 -0
  543. package/dist/script/conversion-read.js +69 -0
  544. package/dist/script/conversion-read.js.map +1 -0
  545. package/dist/script/conversion-write.d.ts +14 -0
  546. package/dist/script/conversion-write.d.ts.map +1 -0
  547. package/dist/script/conversion-write.js +34 -0
  548. package/dist/script/conversion-write.js.map +1 -0
  549. package/dist/script/conversion.d.ts +10 -16
  550. package/dist/script/conversion.d.ts.map +1 -1
  551. package/dist/script/conversion.js +2 -115
  552. package/dist/script/conversion.js.map +1 -1
  553. package/dist/search/candidate-narrowing.d.ts +56 -0
  554. package/dist/search/candidate-narrowing.d.ts.map +1 -0
  555. package/dist/search/candidate-narrowing.js +55 -0
  556. package/dist/search/candidate-narrowing.js.map +1 -0
  557. package/dist/search/candidate-query.d.ts +25 -0
  558. package/dist/search/candidate-query.d.ts.map +1 -0
  559. package/dist/search/candidate-query.js +28 -0
  560. package/dist/search/candidate-query.js.map +1 -0
  561. package/dist/search/candidate-writings.d.ts +24 -0
  562. package/dist/search/candidate-writings.d.ts.map +1 -0
  563. package/dist/search/candidate-writings.js +114 -0
  564. package/dist/search/candidate-writings.js.map +1 -0
  565. package/dist/search/candidates.d.ts +7 -41
  566. package/dist/search/candidates.d.ts.map +1 -1
  567. package/dist/search/candidates.js +10 -164
  568. package/dist/search/candidates.js.map +1 -1
  569. package/dist/search/match-chunks.d.ts +19 -0
  570. package/dist/search/match-chunks.d.ts.map +1 -0
  571. package/dist/search/match-chunks.js +30 -0
  572. package/dist/search/match-chunks.js.map +1 -0
  573. package/dist/search/match-ranking.d.ts +39 -0
  574. package/dist/search/match-ranking.d.ts.map +1 -0
  575. package/dist/search/match-ranking.js +51 -0
  576. package/dist/search/match-ranking.js.map +1 -0
  577. package/dist/search/match-readings.d.ts +43 -0
  578. package/dist/search/match-readings.d.ts.map +1 -0
  579. package/dist/search/match-readings.js +83 -0
  580. package/dist/search/match-readings.js.map +1 -0
  581. package/dist/search/match-scoring.d.ts +146 -0
  582. package/dist/search/match-scoring.d.ts.map +1 -0
  583. package/dist/search/match-scoring.js +114 -0
  584. package/dist/search/match-scoring.js.map +1 -0
  585. package/dist/search/match-search.d.ts +28 -0
  586. package/dist/search/match-search.d.ts.map +1 -0
  587. package/dist/search/match-search.js +128 -0
  588. package/dist/search/match-search.js.map +1 -0
  589. package/dist/search/match.d.ts +5 -36
  590. package/dist/search/match.d.ts.map +1 -1
  591. package/dist/search/match.js +2 -379
  592. package/dist/search/match.js.map +1 -1
  593. package/dist/search/reverse-index-build.d.ts +30 -0
  594. package/dist/search/reverse-index-build.d.ts.map +1 -0
  595. package/dist/search/reverse-index-build.js +72 -0
  596. package/dist/search/reverse-index-build.js.map +1 -0
  597. package/dist/search/reverse-index-format.d.ts +60 -0
  598. package/dist/search/reverse-index-format.d.ts.map +1 -0
  599. package/dist/search/reverse-index-format.js +54 -0
  600. package/dist/search/reverse-index-format.js.map +1 -0
  601. package/dist/search/reverse-index-groups.d.ts +37 -0
  602. package/dist/search/reverse-index-groups.d.ts.map +1 -0
  603. package/dist/search/reverse-index-groups.js +71 -0
  604. package/dist/search/reverse-index-groups.js.map +1 -0
  605. package/dist/search/reverse-index-passes.d.ts +78 -0
  606. package/dist/search/reverse-index-passes.d.ts.map +1 -0
  607. package/dist/search/reverse-index-passes.js +59 -0
  608. package/dist/search/reverse-index-passes.js.map +1 -0
  609. package/dist/search/reverse-index-state.d.ts +36 -0
  610. package/dist/search/reverse-index-state.d.ts.map +1 -0
  611. package/dist/search/reverse-index-state.js +95 -0
  612. package/dist/search/reverse-index-state.js.map +1 -0
  613. package/dist/search/reverse-index.d.ts +8 -67
  614. package/dist/search/reverse-index.d.ts.map +1 -1
  615. package/dist/search/reverse-index.js +4 -255
  616. package/dist/search/reverse-index.js.map +1 -1
  617. package/dist/sources/unihan-readings.d.ts +58 -0
  618. package/dist/sources/unihan-readings.d.ts.map +1 -0
  619. package/dist/sources/unihan-readings.js +95 -0
  620. package/dist/sources/unihan-readings.js.map +1 -0
  621. package/dist/sources/unihan.d.ts +6 -9
  622. package/dist/sources/unihan.d.ts.map +1 -1
  623. package/dist/sources/unihan.js +2 -85
  624. package/dist/sources/unihan.js.map +1 -1
  625. package/dist/syllable/final-tables.d.ts +23 -0
  626. package/dist/syllable/final-tables.d.ts.map +1 -0
  627. package/dist/syllable/final-tables.js +50 -0
  628. package/dist/syllable/final-tables.js.map +1 -0
  629. package/dist/syllable/inventory.d.ts +8 -42
  630. package/dist/syllable/inventory.d.ts.map +1 -1
  631. package/dist/syllable/inventory.js +9 -918
  632. package/dist/syllable/inventory.js.map +1 -1
  633. package/dist/syllable/spellings.d.ts +40 -0
  634. package/dist/syllable/spellings.d.ts.map +1 -0
  635. package/dist/syllable/spellings.js +469 -0
  636. package/dist/syllable/spellings.js.map +1 -0
  637. package/dist/syllable/syllable-parts.d.ts +31 -0
  638. package/dist/syllable/syllable-parts.d.ts.map +1 -0
  639. package/dist/syllable/syllable-parts.js +105 -0
  640. package/dist/syllable/syllable-parts.js.map +1 -0
  641. package/dist/syllable/syllable.d.ts +1 -14
  642. package/dist/syllable/syllable.d.ts.map +1 -1
  643. package/dist/syllable/syllable.js +3 -144
  644. package/dist/syllable/syllable.js.map +1 -1
  645. package/dist/syllable/written-tones.d.ts +6 -0
  646. package/dist/syllable/written-tones.d.ts.map +1 -0
  647. package/dist/syllable/written-tones.js +453 -0
  648. package/dist/syllable/written-tones.js.map +1 -0
  649. package/dist/transcription/bopomofo-parse.d.ts +42 -0
  650. package/dist/transcription/bopomofo-parse.d.ts.map +1 -0
  651. package/dist/transcription/bopomofo-parse.js +92 -0
  652. package/dist/transcription/bopomofo-parse.js.map +1 -0
  653. package/dist/transcription/bopomofo-reverse.d.ts +31 -0
  654. package/dist/transcription/bopomofo-reverse.d.ts.map +1 -0
  655. package/dist/transcription/bopomofo-reverse.js +48 -0
  656. package/dist/transcription/bopomofo-reverse.js.map +1 -0
  657. package/dist/transcription/bopomofo-symbols.d.ts +36 -0
  658. package/dist/transcription/bopomofo-symbols.d.ts.map +1 -0
  659. package/dist/transcription/bopomofo-symbols.js +41 -0
  660. package/dist/transcription/bopomofo-symbols.js.map +1 -0
  661. package/dist/transcription/bopomofo-tables.d.ts +87 -0
  662. package/dist/transcription/bopomofo-tables.d.ts.map +1 -0
  663. package/dist/transcription/bopomofo-tables.js +180 -0
  664. package/dist/transcription/bopomofo-tables.js.map +1 -0
  665. package/dist/transcription/bopomofo.d.ts +14 -32
  666. package/dist/transcription/bopomofo.d.ts.map +1 -1
  667. package/dist/transcription/bopomofo.js +5 -343
  668. package/dist/transcription/bopomofo.js.map +1 -1
  669. package/dist/transcription/gwoyeu-first-second.d.ts +36 -0
  670. package/dist/transcription/gwoyeu-first-second.d.ts.map +1 -0
  671. package/dist/transcription/gwoyeu-first-second.js +75 -0
  672. package/dist/transcription/gwoyeu-first-second.js.map +1 -0
  673. package/dist/transcription/gwoyeu-spelling.d.ts +38 -0
  674. package/dist/transcription/gwoyeu-spelling.d.ts.map +1 -0
  675. package/dist/transcription/gwoyeu-spelling.js +124 -0
  676. package/dist/transcription/gwoyeu-spelling.js.map +1 -0
  677. package/dist/transcription/gwoyeu-tables.d.ts +93 -0
  678. package/dist/transcription/gwoyeu-tables.d.ts.map +1 -0
  679. package/dist/transcription/gwoyeu-tables.js +205 -0
  680. package/dist/transcription/gwoyeu-tables.js.map +1 -0
  681. package/dist/transcription/gwoyeu-tonal-forms.d.ts +49 -0
  682. package/dist/transcription/gwoyeu-tonal-forms.d.ts.map +1 -0
  683. package/dist/transcription/gwoyeu-tonal-forms.js +89 -0
  684. package/dist/transcription/gwoyeu-tonal-forms.js.map +1 -0
  685. package/dist/transcription/gwoyeu-vowels.d.ts +51 -0
  686. package/dist/transcription/gwoyeu-vowels.d.ts.map +1 -0
  687. package/dist/transcription/gwoyeu-vowels.js +58 -0
  688. package/dist/transcription/gwoyeu-vowels.js.map +1 -0
  689. package/dist/transcription/gwoyeu.d.ts +1 -26
  690. package/dist/transcription/gwoyeu.d.ts.map +1 -1
  691. package/dist/transcription/gwoyeu.js +2 -540
  692. package/dist/transcription/gwoyeu.js.map +1 -1
  693. package/dist/transcription/ipa-symbols.d.ts +67 -0
  694. package/dist/transcription/ipa-symbols.d.ts.map +1 -0
  695. package/dist/transcription/ipa-symbols.js +135 -0
  696. package/dist/transcription/ipa-symbols.js.map +1 -0
  697. package/dist/transcription/ipa.d.ts +2 -10
  698. package/dist/transcription/ipa.d.ts.map +1 -1
  699. package/dist/transcription/ipa.js +2 -134
  700. package/dist/transcription/ipa.js.map +1 -1
  701. package/dist/transcription/wade-giles-index.d.ts +35 -0
  702. package/dist/transcription/wade-giles-index.d.ts.map +1 -0
  703. package/dist/transcription/wade-giles-index.js +110 -0
  704. package/dist/transcription/wade-giles-index.js.map +1 -0
  705. package/dist/transcription/wade-giles-parse.d.ts +36 -0
  706. package/dist/transcription/wade-giles-parse.d.ts.map +1 -0
  707. package/dist/transcription/wade-giles-parse.js +84 -0
  708. package/dist/transcription/wade-giles-parse.js.map +1 -0
  709. package/dist/transcription/wade-giles-spelling.d.ts +61 -0
  710. package/dist/transcription/wade-giles-spelling.d.ts.map +1 -0
  711. package/dist/transcription/wade-giles-spelling.js +107 -0
  712. package/dist/transcription/wade-giles-spelling.js.map +1 -0
  713. package/dist/transcription/wade-giles-syllable.d.ts +29 -0
  714. package/dist/transcription/wade-giles-syllable.d.ts.map +1 -0
  715. package/dist/transcription/wade-giles-syllable.js +90 -0
  716. package/dist/transcription/wade-giles-syllable.js.map +1 -0
  717. package/dist/transcription/wade-giles-tables.d.ts +80 -0
  718. package/dist/transcription/wade-giles-tables.d.ts.map +1 -0
  719. package/dist/transcription/wade-giles-tables.js +178 -0
  720. package/dist/transcription/wade-giles-tables.js.map +1 -0
  721. package/dist/transcription/wade-giles.d.ts +9 -60
  722. package/dist/transcription/wade-giles.d.ts.map +1 -1
  723. package/dist/transcription/wade-giles.js +6 -543
  724. package/dist/transcription/wade-giles.js.map +1 -1
  725. package/dist/transcription/yale-tables.d.ts +54 -0
  726. package/dist/transcription/yale-tables.d.ts.map +1 -0
  727. package/dist/transcription/yale-tables.js +125 -0
  728. package/dist/transcription/yale-tables.js.map +1 -0
  729. package/dist/transcription/yale.d.ts.map +1 -1
  730. package/dist/transcription/yale.js +1 -124
  731. package/dist/transcription/yale.js.map +1 -1
  732. package/package.json +2 -2
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Reading CC-CEDICT: indexing its entries, and telling its senses apart.
3
+ *
4
+ * CC-CEDICT gives a word one entry per pronunciation and keys each under both
5
+ * scripts, so getting anything out of it means first deciding which entries
6
+ * describe the word in hand and which describe a different one written alike.
7
+ */
8
+ import { isSingleCharacter } from "../script/characters.js";
9
+ import { isSameReading } from "./entry.js";
10
+ import { readDictionaryReading } from "./reading.js";
11
+ /**
12
+ * Whether a phrase-corpus headword is really the 繁體 spelling of another word.
13
+ *
14
+ * `large_pinyin.txt` is a 简体 corpus, and where it carries a 繁體 headword
15
+ * anyway it has read it as though the characters were 简体: 特徵 is `tè zhǐ`
16
+ * there because 徵 alone is `zhǐ`, 沈溺 is `shěn nì` because 沈 alone is the
17
+ * surname, 蝨子 is `shī zǐ`, 纔然 is `shān rán`. Every one of those is a word
18
+ * whose 简体 form the corpus also carries, correctly.
19
+ *
20
+ * Left in, each becomes an entry of its own that outranks the 繁體 key the
21
+ * derivation would have hung on the 简体 entry, so the word reads one way in a
22
+ * tier holding the phrase tail and another way in a tier without it.
23
+ *
24
+ * So the corpus is held to its own contract: a headword CC-CEDICT knows only as
25
+ * the 繁體 spelling of a different 简体 word contributes no entry, and the word
26
+ * keeps the reading CC-CEDICT pairs it with. It is 72 headwords, 13 of which
27
+ * the corpus reads wrongly; the other 59 arrive at the same reading either way.
28
+ *
29
+ * Narrow on purpose. 2,854 corpus headwords contain a 繁體-only character and
30
+ * only these 72 are ones CC-CEDICT pairs — the rest are rare or mixed-script
31
+ * words whose characters do read them, and dropping those would lose coverage
32
+ * to fix nothing.
33
+ */
34
+ export function isSpeltTraditionally(word, byWord, byHant) {
35
+ if (byWord.has(word)) {
36
+ return false;
37
+ }
38
+ return (byHant.get(word) ?? []).some((entry) => entry.simplified !== entry.traditional);
39
+ }
40
+ /**
41
+ * CC-CEDICT's entries for a word, keyed by one of its two written forms.
42
+ */
43
+ export function indexCedict(cedict, formOf) {
44
+ const byWord = new Map();
45
+ for (const entry of cedict) {
46
+ const form = formOf(entry);
47
+ const existing = byWord.get(form);
48
+ if (existing === undefined) {
49
+ byWord.set(form, [entry]);
50
+ }
51
+ else {
52
+ existing.push(entry);
53
+ }
54
+ }
55
+ return byWord;
56
+ }
57
+ /**
58
+ * A word's readings as CC-CEDICT gives them, one per sense.
59
+ */
60
+ export function cedictReadingsOf(word, entries) {
61
+ return entries
62
+ .map((entry) => readDictionaryReading(word, entry.readings))
63
+ .filter((reading) => reading !== undefined);
64
+ }
65
+ /**
66
+ * Ask either index for every reading CC-CEDICT gives a spelling.
67
+ *
68
+ * Both scripts, because a word can be listed under one and not the other, and
69
+ * an empty answer means CC-CEDICT does not hold the spelling at all.
70
+ */
71
+ export function senseLookup(byWord, byHant) {
72
+ return (word) => [
73
+ ...cedictReadingsOf(word, byWord.get(word) ?? []),
74
+ ...cedictReadingsOf(word, byHant.get(word) ?? []),
75
+ ];
76
+ }
77
+ /**
78
+ * Whether a proposed 國語 reading is really another 普通话 sense of the word.
79
+ *
80
+ * The test that separates a locale shift from a sense selection, which the
81
+ * sources write the same way and mean differently. 地 is offered `dì` against a
82
+ * 普通话 `de` — but CC-CEDICT lists 地[de5] and 地[di4] as two entries, so `dì`
83
+ * is what 地 reads in 普通话 when it means the ground, not what 國語 does to the
84
+ * particle. The adverbial 地 is `de` in Taipei too, and 4,240 entries end in it.
85
+ * 都 is the same shape, and so are 着, 应, 差, 称, 斗, 舍, 薄 and 万.
86
+ *
87
+ * A genuine delta leaves no such trace: nothing in 普通话 reads 和 as `hàn`, 期
88
+ * as `qí` or 垃 as `lè`, which is why those survive this and 71 characters and
89
+ * 3 words do not.
90
+ *
91
+ * Only CC-CEDICT is consulted. Unihan's reading fields carry rare and historical
92
+ * pronunciations alongside current ones — 驯 is listed `xún` somewhere in them —
93
+ * and a reading no one uses today is not evidence that a source meant a sense
94
+ * rather than a locale.
95
+ */
96
+ export function isOwnSense(taiwan, senseReadings) {
97
+ return senseReadings.some((sense) => isSameReading(sense, taiwan));
98
+ }
99
+ /**
100
+ * Whether a character's `Taiwan pr.` note describes one sense rather than the
101
+ * character.
102
+ *
103
+ * The other half of the sense test, and the one {@link isOwnSense} cannot do.
104
+ * That test asks whether the offered reading is a 普通话 sense of the word; this
105
+ * asks whether the note was ever about the whole word to begin with. 從's
106
+ * `Taiwan pr. [zong4]` sits on three of its eight senses — 侍從, 從兄弟, 從犯 —
107
+ * and 教育部's dictionary agrees with CC-CEDICT about which: 跟隨, 依順, 參與 and
108
+ * the preposition are `cóng` in Taipei exactly as they are in Beijing. Applying
109
+ * it to the headword made 我从北京来 read `wǒ zòng Běijīng lái`. 會 (`huǐ`, only
110
+ * 一會兒), 勞 (`lào`, only 慰勞) and 燥 (`sào`, only 肉燥) are the same shape.
111
+ *
112
+ * A note the entry leads with is kept, because the leading sense is what the
113
+ * character means with nothing to narrow it: 和's `hàn` is on the conjunction,
114
+ * which is what a bare 和 almost always is.
115
+ *
116
+ * **Only a character is tested this way.** Its entry is what every occurrence
117
+ * no longer word covers falls back to, so it has to carry the reading that
118
+ * survives out of context; a multi-character headword is reached only where
119
+ * that exact word is written. Four of them carry an inline note — 相親, 載具,
120
+ * 高挑 and 樂色 — and only 相親 has senses that differ, its dominant one being
121
+ * the matchmaking sense that really is `xiàngqīn`.
122
+ */
123
+ export function isSenseScopedNote(word, sense) {
124
+ return sense?.taiwanScope === "sense" && isSingleCharacter(word);
125
+ }
126
+ //# sourceMappingURL=cedict-senses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cedict-senses.js","sourceRoot":"","sources":["../../src/dictionary/cedict-senses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,MAAmD,EACnD,MAAmD;IAEnD,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAClC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,WAAW,CAClD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,MAA8B,EAC9B,MAAsC;IAEtC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAC;IAChD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,OAA+B;IAE/B,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;SAC3D,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,MAAmD,EACnD,MAAmD;IAEnD,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QACf,GAAG,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACjD,GAAG,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;KAClD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,UAAU,CACxB,MAA2B,EAC3B,aAA+C;IAE/C,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ,KAA8B;IAE9B,OAAO,KAAK,EAAE,WAAW,KAAK,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { CedictEntry } from "../sources/cedict.js";
2
+ import type { Syllable } from "../syllable/syllable.js";
3
+ import { TraditionalTable } from "./traditional.js";
4
+ import type { MergeSources } from "./merge-types.js";
5
+ /**
6
+ * Parse a Unihan reading string for one character.
7
+ *
8
+ * Goes through the dictionary reader so that a Unihan reading gets the same
9
+ * treatment as any other source's: an unmarked tone means neutral, and 一 and
10
+ * 不 are restored to their underlying tones.
11
+ */
12
+ export declare function characterSyllable(character: string, reading: string): Syllable | undefined;
13
+ /**
14
+ * The 繁體 table and the character defaults, with the count of defaults a
15
+ * reduced 轻声 would otherwise have set.
16
+ */
17
+ export interface CharacterDefaults {
18
+ readonly traditional: TraditionalTable;
19
+ readonly defaults: ReadonlyMap<string, readonly Syllable[]>;
20
+ readonly reducedNeutrals: number;
21
+ }
22
+ /**
23
+ * Build both, from the sources and CC-CEDICT's two indexes.
24
+ */
25
+ export declare function buildCharacterDefaults(sources: MergeSources, cedictByWord: ReadonlyMap<string, readonly CedictEntry[]>, cedictByHant: ReadonlyMap<string, readonly CedictEntry[]>): CharacterDefaults;
26
+ //# sourceMappingURL=character-defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"character-defaults.d.ts","sourceRoot":"","sources":["../../src/dictionary/character-defaults.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAGL,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,QAAQ,GAAG,SAAS,CAEtB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC,CAAC;IAC5D,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,YAAY,EACrB,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,EACzD,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,GACxD,iBAAiB,CAiDnB"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * What every later step of the merge leans on: the 繁體 pairing table and each
3
+ * character's default reading.
4
+ *
5
+ * Both come out of the sources alone, before a single word has been looked at,
6
+ * and the order matters — the corpus mass the defaults are ranked by reaches
7
+ * 繁體 characters only through the pairing table.
8
+ */
9
+ import { countCorpusMass, rankByCorpusMass } from "./corpus-mass.js";
10
+ import { demoteReducedNeutrals, isNeutralAlone, resolveFrequencyTones, } from "./frequency-tones.js";
11
+ import { readAlignedReading, readDictionaryReading } from "./reading.js";
12
+ import { pairScripts, TraditionalTable, } from "./traditional.js";
13
+ /**
14
+ * Parse a Unihan reading string for one character.
15
+ *
16
+ * Goes through the dictionary reader so that a Unihan reading gets the same
17
+ * treatment as any other source's: an unmarked tone means neutral, and 一 and
18
+ * 不 are restored to their underlying tones.
19
+ */
20
+ export function characterSyllable(character, reading) {
21
+ return readDictionaryReading(character, [reading])?.[0];
22
+ }
23
+ /**
24
+ * Build both, from the sources and CC-CEDICT's two indexes.
25
+ */
26
+ export function buildCharacterDefaults(sources, cedictByWord, cedictByHant) {
27
+ const { unihanReadings, unihanVariants, phrase, cedict, jieba } = sources;
28
+ // ── 繁體 evidence, mined from CC-CEDICT's own pairings ──────
29
+ // Before the character defaults, because the corpus mass those are ranked by
30
+ // has to reach 繁體 characters through this table: jieba's corpus and the
31
+ // phrase corpus are both 简体, so nothing else would count a vote for 髮.
32
+ const pairings = [];
33
+ for (const entry of cedict) {
34
+ const aligned = readAlignedReading(entry.simplified, entry.readings);
35
+ pairings.push(...pairScripts(entry.simplified, entry.traditional, aligned));
36
+ }
37
+ const traditional = TraditionalTable.build(pairings, unihanVariants, unihanReadings);
38
+ // ── Character defaults, which every later step leans on ────
39
+ // Unihan ranks the readings and the corpus re-ranks the ones it has seen: a
40
+ // character's default is whichever of its readings the dictionary's own words
41
+ // spend the most of jieba's corpus on, and Unihan's order decides the rest.
42
+ const mass = countCorpusMass({ phrase, cedict, jieba }, traditional);
43
+ const defaults = new Map();
44
+ let reducedNeutrals = 0;
45
+ for (const [character, readings] of unihanReadings) {
46
+ const resolved = resolveFrequencyTones(readings);
47
+ // A 轻声 the frequency field only ever counted inside words is not the
48
+ // character's reading — unless a source says the bare character is neutral.
49
+ const ranked = isNeutralAlone(character, [
50
+ ...(cedictByWord.get(character) ?? []),
51
+ ...(cedictByHant.get(character) ?? []),
52
+ ])
53
+ ? resolved
54
+ : demoteReducedNeutrals(readings, resolved);
55
+ if (ranked !== resolved && ranked[0] !== resolved[0]) {
56
+ reducedNeutrals++;
57
+ }
58
+ const parsed = ranked
59
+ .map((reading) => characterSyllable(character, reading))
60
+ .filter((syllable) => syllable !== undefined);
61
+ if (parsed.length > 0) {
62
+ defaults.set(character, rankByCorpusMass(character, parsed, readings.fields, mass));
63
+ }
64
+ }
65
+ return { traditional, defaults, reducedNeutrals };
66
+ }
67
+ //# sourceMappingURL=character-defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"character-defaults.js","sourceRoot":"","sources":["../../src/dictionary/character-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EACL,WAAW,EAEX,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAiB,EACjB,OAAe;IAEf,OAAO,qBAAqB,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAYD;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAqB,EACrB,YAAyD,EACzD,YAAyD;IAEzD,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1E,6DAA6D;IAC7D,6EAA6E;IAC7E,wEAAwE;IACxE,uEAAuE;IACvE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IACrC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QACrE,QAAQ,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9E,CAAC;IACD,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CACxC,QAAQ,EACR,cAAc,EACd,cAAc,CACf,CAAC;IAEF,8DAA8D;IAC9D,4EAA4E;IAC5E,8EAA8E;IAC9E,4EAA4E;IAC5E,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,WAAW,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA+B,CAAC;IACxD,IAAI,eAAe,GAAG,CAAC,CAAC;IACxB,KAAK,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,cAAc,EAAE,CAAC;QACnD,MAAM,QAAQ,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACjD,qEAAqE;QACrE,4EAA4E;QAC5E,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,EAAE;YACvC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YACtC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;SACvC,CAAC;YACA,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC9C,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,eAAe,EAAE,CAAC;QACpB,CAAC;QACD,MAAM,MAAM,GAAG,MAAM;aAClB,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;aACvD,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,QAAQ,CAAC,GAAG,CACV,SAAS,EACT,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAC3D,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;AACpD,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Single characters whose default reading a source would otherwise get wrong.
3
+ *
4
+ * Two source quirks between them: the 简体 phrase corpus carrying a 繁體
5
+ * headword and reading it as though the characters were 简体, and Unihan's
6
+ * frequency field counting a 轻声 that only occurs inside words.
7
+ */
8
+ import type { BuildAssertion } from "./built-dictionary.js";
9
+ export declare const CHARACTER_READINGS: readonly BuildAssertion[];
10
+ //# sourceMappingURL=character-readings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"character-readings.d.ts","sourceRoot":"","sources":["../../src/dictionary/character-readings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,eAAO,MAAM,kBAAkB,EAAE,SAAS,cAAc,EAsBvD,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { reads } from "./word-readings.js";
2
+ export const CHARACTER_READINGS = [
3
+ // The 简体 phrase corpus carries a few 繁體 headwords and reads them as
4
+ // though the characters were 简体 — 徵 as `zhǐ` rather than as 征, 沈 as the
5
+ // surname rather than as 沉. Left as entries of their own they outrank the
6
+ // 繁體 key derived from the 简体 entry, and the word reads one way in a tier
7
+ // holding the phrase tail and another way in a tier without it.
8
+ reads("特徵", "tè zhēng", "not tè zhǐ, which is 徵 read as itself"),
9
+ reads("沈溺", "chén nì", "not shěn nì, which is 沈 read as the surname"),
10
+ reads("蝨子", "shī zi", "not shī zǐ, which is 子 read with its full tone"),
11
+ // kHanyuPinlu writes 李 as `li(36)`, with no tone mark. Read as 轻声 — which
12
+ // is what an unmarked reading means everywhere else in source data — 李华
13
+ // comes out `Li Huá`. The other Unihan fields all write `lǐ`, and that is
14
+ // what settles it. 们 is the control: genuinely neutral, and written bare by
15
+ // the other fields too, so it must not be "corrected".
16
+ reads("李", "lǐ", "a tone kHanyuPinlu left off is restored"),
17
+ reads("们", "men", "a genuine 轻声 is not given a tone it never had"),
18
+ reads("吧", "ba", "the 语气词, not the 酒吧 the corpus mass counts"),
19
+ reads("酒吧", "jiǔ bā", "and the word the character keeps its full tone in"),
20
+ reads("西", "xī", "a 轻声 counted only inside words does not lead"),
21
+ reads("子", "zǐ", "and a suffix sense is not a claim about the character"),
22
+ reads("夫", "fū", "nor is 大夫's and 丈夫's reduction"),
23
+ reads("吗", "ma", "but a 语气词 CC-CEDICT reads 轻声 alone keeps it"),
24
+ ];
25
+ //# sourceMappingURL=character-readings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"character-readings.js","sourceRoot":"","sources":["../../src/dictionary/character-readings.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,MAAM,kBAAkB,GAA8B;IAC3D,oEAAoE;IACpE,wEAAwE;IACxE,0EAA0E;IAC1E,yEAAyE;IACzE,gEAAgE;IAChE,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,uCAAuC,CAAC;IAChE,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,6CAA6C,CAAC;IACrE,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,gDAAgD,CAAC;IACvE,0EAA0E;IAC1E,wEAAwE;IACxE,0EAA0E;IAC1E,4EAA4E;IAC5E,uDAAuD;IACvD,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,yCAAyC,CAAC;IAC3D,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,+CAA+C,CAAC;IAClE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,4CAA4C,CAAC;IAC9D,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,mDAAmD,CAAC;IAC1E,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,8CAA8C,CAAC;IAChE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,uDAAuD,CAAC;IACzE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,gCAAgC,CAAC;IAClD,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,6CAA6C,CAAC;CAChE,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { Syllable } from "../syllable/syllable.js";
2
+ import { type DictionaryEntry } from "./entry.js";
3
+ /**
4
+ * What the repair pass changed.
5
+ */
6
+ export interface ConstituentRepair {
7
+ readonly entries: readonly DictionaryEntry[];
8
+ /** Entries given a reading from a word inside them. */
9
+ readonly repaired: number;
10
+ }
11
+ /**
12
+ * Read a phrase entry as the corroborated words inside it read it.
13
+ *
14
+ * 做什么 is stored `zuò shí mǒ` upstream, and 什么 is `shén me` in the same file
15
+ * and in CC-CEDICT besides. The decode has no way back from that: the four
16
+ * characters are one dictionary key, so the key answers and the word inside it
17
+ * is never asked. 什么意思, 不记得 and 这么说 are the same defect, and between
18
+ * them they account for 160 of the 290 sentences a downstream corpus of 13,182
19
+ * reported as misread.
20
+ *
21
+ * The pass runs over entries **nothing but the phrase corpus attests** — no
22
+ * CC-CEDICT headword under either script, no jieba frequency — and takes each
23
+ * one's constituents from `ConstituentIndex`, the same segmentation the locale
24
+ * composition uses. Only a constituent CC-CEDICT holds may correct anything, so
25
+ * this never trades one uncorroborated reading for another. What survives
26
+ * {@link corrects} replaces the span it covers.
27
+ *
28
+ * Measured on the full dictionary it repairs 1,727 entries of the 250,417 it
29
+ * looks at. Sampled by hand at every 61st, the repairs are neutral tones the
30
+ * corpus wrote out in full (骨头, 大夫, 秀才, 和尚), spellings it got wrong
31
+ * (相扑 `xiàng pū`, 武侯 `wǔ hòu`, 用尽 `yòng jǐn`) and one entry with no tones
32
+ * at all (激昂青云). The doubtful ones are homographs either reading is
33
+ * defensible for: 倒数比 and 面糊盆.
34
+ */
35
+ export declare function repairConstituentReadings(entries: readonly DictionaryEntry[], sensesOf: (word: string) => readonly (readonly Syllable[])[]): ConstituentRepair;
36
+ //# sourceMappingURL=constituent-repair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constituent-repair.d.ts","sourceRoot":"","sources":["../../src/dictionary/constituent-repair.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,YAAY,CAAC;AAGjE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AA0CD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC,SAAS,QAAQ,EAAE,CAAC,EAAE,GAC3D,iBAAiB,CAmDnB"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Holding a phrase entry to what the words inside it already read.
3
+ *
4
+ * The phrase corpus is a reading source and not a word list, and 251,528 of its
5
+ * 411,956 keys are in neither CC-CEDICT nor jieba. Much of that tail is running
6
+ * text rather than vocabulary — 做什么, 什么意思, 不记得, 一个幽灵在欧洲游荡 —
7
+ * and where a key like that carries a defective reading there is nothing to
8
+ * correct it against, because `settleReading` compares a phrase entry with the
9
+ * CC-CEDICT sense of the *same* headword and CC-CEDICT has no such headword.
10
+ *
11
+ * This is that missing correction, taken from the words inside instead.
12
+ */
13
+ import { toCharacters } from "../script/characters.js";
14
+ import { NEUTRAL_TONE } from "../tone/tone.js";
15
+ import { isSameReading } from "./entry.js";
16
+ import { ConstituentIndex } from "./locale-segments.js";
17
+ /**
18
+ * Whether a constituent may correct the span it covers.
19
+ *
20
+ * Four tests, and each one rules out a class of damage:
21
+ *
22
+ * 1. **Multi-character only.** A character's own reading is the prior the
23
+ * phrase entry was built from, so correcting against it says nothing new.
24
+ * It is the same reasoning `composeLocaleDeltas` gives for the same
25
+ * restriction.
26
+ * 2. **One syllable per character on both sides**, or the two readings are not
27
+ * describing the same span character for character.
28
+ * 3. **The span must match no sense CC-CEDICT gives the constituent.** A word
29
+ * with two readings has two senses, and a phrase using the other one is
30
+ * right: 分子 is `fēn zǐ` as a molecule and `fèn zǐ` as a member, so
31
+ * 分子结构 keeps the reading it was given. The build's tier check found this
32
+ * one, which is what that check is for.
33
+ * 4. **No 轻声 may gain a tone.** The phrase corpus writes full tones where
34
+ * CC-CEDICT has neutral and never the reverse, so a correction pushing the
35
+ * other way is not a correction at all — it is a constituent that fell
36
+ * across a boundary. Every 地 in the 268 entries this rules out is the
37
+ * adverbial particle, and the words claiming it are 心地, 性地 and 野地.
38
+ */
39
+ function corrects(part, span, own, senses) {
40
+ if (toCharacters(part.text).length < 2 || own.length !== span.length) {
41
+ return false;
42
+ }
43
+ if (senses.some((sense) => isSameReading(sense, span))) {
44
+ return false;
45
+ }
46
+ return !span.some((syllable, at) => syllable.tone === NEUTRAL_TONE && own[at]?.tone !== NEUTRAL_TONE);
47
+ }
48
+ /**
49
+ * Read a phrase entry as the corroborated words inside it read it.
50
+ *
51
+ * 做什么 is stored `zuò shí mǒ` upstream, and 什么 is `shén me` in the same file
52
+ * and in CC-CEDICT besides. The decode has no way back from that: the four
53
+ * characters are one dictionary key, so the key answers and the word inside it
54
+ * is never asked. 什么意思, 不记得 and 这么说 are the same defect, and between
55
+ * them they account for 160 of the 290 sentences a downstream corpus of 13,182
56
+ * reported as misread.
57
+ *
58
+ * The pass runs over entries **nothing but the phrase corpus attests** — no
59
+ * CC-CEDICT headword under either script, no jieba frequency — and takes each
60
+ * one's constituents from `ConstituentIndex`, the same segmentation the locale
61
+ * composition uses. Only a constituent CC-CEDICT holds may correct anything, so
62
+ * this never trades one uncorroborated reading for another. What survives
63
+ * {@link corrects} replaces the span it covers.
64
+ *
65
+ * Measured on the full dictionary it repairs 1,727 entries of the 250,417 it
66
+ * looks at. Sampled by hand at every 61st, the repairs are neutral tones the
67
+ * corpus wrote out in full (骨头, 大夫, 秀才, 和尚), spellings it got wrong
68
+ * (相扑 `xiàng pū`, 武侯 `wǔ hòu`, 用尽 `yòng jǐn`) and one entry with no tones
69
+ * at all (激昂青云). The doubtful ones are homographs either reading is
70
+ * defensible for: 倒数比 and 面糊盆.
71
+ */
72
+ export function repairConstituentReadings(entries, sensesOf) {
73
+ const index = new ConstituentIndex(entries);
74
+ let repaired = 0;
75
+ const repair = (entry) => {
76
+ const reading = entry.readings.cn;
77
+ if (entry.frequency > 0 ||
78
+ sensesOf(entry.hans).length > 0 ||
79
+ sensesOf(entry.hant).length > 0 ||
80
+ reading.length !== toCharacters(entry.hans).length ||
81
+ reading.length < 2) {
82
+ return entry;
83
+ }
84
+ const path = index.segment(entry.hans);
85
+ if (path === undefined) {
86
+ return entry;
87
+ }
88
+ let corrected = [...reading];
89
+ let isMoved = false;
90
+ for (const part of path) {
91
+ const own = part.entry.readings.cn;
92
+ const senses = [
93
+ ...sensesOf(part.entry.hans),
94
+ ...sensesOf(part.entry.hant),
95
+ ];
96
+ if (senses.length === 0) {
97
+ continue;
98
+ }
99
+ if (!corrects(part, reading.slice(part.from, part.to), own, senses)) {
100
+ continue;
101
+ }
102
+ corrected = [
103
+ ...corrected.slice(0, part.from),
104
+ ...own,
105
+ ...corrected.slice(part.to),
106
+ ];
107
+ isMoved = true;
108
+ }
109
+ if (!isMoved) {
110
+ return entry;
111
+ }
112
+ repaired++;
113
+ return { ...entry, readings: { ...entry.readings, cn: corrected } };
114
+ };
115
+ return { entries: entries.map((entry) => repair(entry)), repaired };
116
+ }
117
+ //# sourceMappingURL=constituent-repair.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constituent-repair.js","sourceRoot":"","sources":["../../src/dictionary/constituent-repair.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,37 @@
1
+ import type { Syllable } from "../syllable/syllable.js";
2
+ /**
3
+ * What the dictionary knows about one word.
4
+ */
5
+ export interface WordEntry {
6
+ readonly word: string;
7
+ /** 普通话 reading. */
8
+ readonly reading: readonly Syllable[];
9
+ /** 國語 reading, absent when it does not differ. */
10
+ readonly taiwanReading?: readonly Syllable[];
11
+ readonly partOfSpeech: string;
12
+ readonly isProperNoun: boolean;
13
+ /**
14
+ * Where a proper name divides into its parts, in characters.
15
+ *
16
+ * Present only where CC-CEDICT's own capitalisation divides it: 齐白石 is
17
+ * `[Qi2 Bai2 shi2]`, 司马迁 `[Si1 ma3 Qian1]`, 上海交通大学
18
+ * `[Shang4 hai3 Jiao1 tong1 Da4 xue2]`. Absent for 马克思 `[Ma3 ke4 si1]`,
19
+ * which is why a transliteration stays one word.
20
+ */
21
+ readonly nameBoundaries?: readonly number[];
22
+ /**
23
+ * Decoding cost, where lower means more likely.
24
+ *
25
+ * Quantised from the corpus frequency; see
26
+ * {@link import("./frequency-table.js").FrequencyTable.costOf}.
27
+ */
28
+ readonly cost: number;
29
+ }
30
+ /**
31
+ * Decode one line's columns into an entry.
32
+ *
33
+ * `readingOf` is asked for a single character's stored reading, and is only
34
+ * reached where the line's own reading column is empty.
35
+ */
36
+ export declare function decodeEntry(word: string, columns: readonly string[], readingOf: (character: string) => string | undefined, cost: number): WordEntry;
37
+ //# sourceMappingURL=dictionary-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionary-entry.d.ts","sourceRoot":"","sources":["../../src/dictionary/dictionary-entry.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mBAAmB;IACnB,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,EAAE,CAAC;IACtC,kDAAkD;IAClD,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC7C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EACpD,IAAI,EAAE,MAAM,GACX,SAAS,CAwBX"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * What one line of the entry blob means, once it is read as a word.
3
+ *
4
+ * The blob is columns of text and `Dictionary` is a store of words; this is
5
+ * where the one becomes the other. It is worth its own module because the
6
+ * decode is the only part of a lookup that knows the artifact's encoding — the
7
+ * flag letters, the boundary notation, the empty reading that means "derive it"
8
+ * — and none of that should be visible to the index and caching around it.
9
+ */
10
+ import { toCharacters } from "../script/characters.js";
11
+ import { decodeReading } from "./artifact.js";
12
+ import { nameBoundariesIn, PROPER_NOUN_FLAG } from "./artifact-format.js";
13
+ /**
14
+ * Decode one line's columns into an entry.
15
+ *
16
+ * `readingOf` is asked for a single character's stored reading, and is only
17
+ * reached where the line's own reading column is empty.
18
+ */
19
+ export function decodeEntry(word, columns, readingOf, cost) {
20
+ const [reading = "", taiwan = "", partOfSpeech = "", flags = ""] = columns;
21
+ // An empty reading means the word is read as its characters' defaults,
22
+ // which is how 87.8% of multi-character entries are stored.
23
+ const encoded = reading === ""
24
+ ? toCharacters(word)
25
+ .map((character) => readingOf(character) ?? "")
26
+ .join(" ")
27
+ : reading;
28
+ const decoded = decodeReading(encoded) ?? [];
29
+ const taiwanReading = decodeReading(taiwan);
30
+ const nameBoundaries = nameBoundariesIn(flags);
31
+ return {
32
+ word,
33
+ reading: decoded,
34
+ ...(taiwanReading !== undefined && { taiwanReading }),
35
+ partOfSpeech,
36
+ isProperNoun: flags.includes(PROPER_NOUN_FLAG),
37
+ ...(nameBoundaries.length > 0 && { nameBoundaries }),
38
+ cost,
39
+ };
40
+ }
41
+ //# sourceMappingURL=dictionary-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionary-entry.js","sourceRoot":"","sources":["../../src/dictionary/dictionary-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA+B1E;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,IAAY,EACZ,OAA0B,EAC1B,SAAoD,EACpD,IAAY;IAEZ,MAAM,CAAC,OAAO,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,EAAE,YAAY,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;IAE3E,uEAAuE;IACvE,4DAA4D;IAC5D,MAAM,OAAO,GACX,OAAO,KAAK,EAAE;QACZ,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;aACf,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;aAC9C,IAAI,CAAC,GAAG,CAAC;QACd,CAAC,CAAC,OAAO,CAAC;IACd,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC7C,MAAM,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,cAAc,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAE/C,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,OAAO;QAChB,GAAG,CAAC,aAAa,KAAK,SAAS,IAAI,EAAE,aAAa,EAAE,CAAC;QACrD,YAAY;QACZ,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAC9C,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC;QACpD,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The readings the entry blob holds, short of decoding a whole entry.
3
+ *
4
+ * Three questions that all stop at the reading columns: what one key is read
5
+ * as, what every key is read as, and what else a character can be read as. None
6
+ * of them wants the other four columns, and the first two never leave the
7
+ * string level at all — which is what makes a pass over all 723,147 keys
8
+ * affordable at load time, and what keeps the entry decoder out of this path.
9
+ */
10
+ import type { Syllable } from "../syllable/syllable.js";
11
+ import type { EntryLines } from "./entry-lines.js";
12
+ import type { KeyIndex } from "./key-index.js";
13
+ /**
14
+ * The stored reading of a key, or undefined when it is not a key.
15
+ *
16
+ * Read from the blob without decoding the rest of the line, since deriving a
17
+ * word's reading needs its characters' readings and nothing else about them.
18
+ */
19
+ export declare function storedReadingOf(index: KeyIndex, lines: EntryLines, word: string): string | undefined;
20
+ /**
21
+ * The other readings recorded on a line, after the one the entry names.
22
+ *
23
+ * The lattice needs these for its single-character fallback edges: 行 has to
24
+ * offer `xíng`, `háng` and `héng` at a position no word covers.
25
+ */
26
+ export declare function alternateReadings(lines: EntryLines, at: number): readonly (readonly Syllable[])[];
27
+ /**
28
+ * Every key's reading, in key order, at the string level.
29
+ *
30
+ * The seam a second index over the same artifact is built through.
31
+ *
32
+ * Handed out as a cursor rather than as an array because the array is 39 MB on
33
+ * the full tier. What the cursor holds instead is the character defaults a
34
+ * derived reading is assembled from, and dropping it releases them.
35
+ */
36
+ export interface DictionaryReadings {
37
+ /** How many positions there are, which is the dictionary's own size. */
38
+ readonly size: number;
39
+ /**
40
+ * The reading at a position, in the artifact's tone-numbered spelling.
41
+ *
42
+ * Empty where the position is out of range, or where a character the word is
43
+ * written with is not itself a key.
44
+ */
45
+ readonly readingAt: (at: number) => string;
46
+ }
47
+ /**
48
+ * A cursor over every key's reading, in key order.
49
+ *
50
+ * Two passes, mirroring `readArtifact`: the character defaults are gathered
51
+ * first, because 83.25% of the full tier's keys store no reading and mean "the
52
+ * characters' defaults, in order". Holding the cursor holds those defaults, so
53
+ * build what needs it, use it, and let it go.
54
+ */
55
+ export declare function readingsCursor(index: KeyIndex, lines: EntryLines): DictionaryReadings;
56
+ //# sourceMappingURL=dictionary-readings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionary-readings.d.ts","sourceRoot":"","sources":["../../src/dictionary/dictionary-readings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI/C;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,QAAQ,EACf,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAGpB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,UAAU,EACjB,EAAE,EAAE,MAAM,GACT,SAAS,CAAC,SAAS,QAAQ,EAAE,CAAC,EAAE,CAKlC;AAmDD;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,QAAQ,EACf,KAAK,EAAE,UAAU,GAChB,kBAAkB,CAiBpB"}