@kensio/pinyinjs 1.7.3 → 1.7.5

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 (695) hide show
  1. package/dist/accuracy/score-case.d.ts +23 -0
  2. package/dist/accuracy/score-case.d.ts.map +1 -0
  3. package/dist/accuracy/score-case.js +63 -0
  4. package/dist/accuracy/score-case.js.map +1 -0
  5. package/dist/accuracy/score.d.ts +1 -8
  6. package/dist/accuracy/score.d.ts.map +1 -1
  7. package/dist/accuracy/score.js +1 -55
  8. package/dist/accuracy/score.js.map +1 -1
  9. package/dist/cli/arguments.d.ts +4 -290
  10. package/dist/cli/arguments.d.ts.map +1 -1
  11. package/dist/cli/arguments.js +5 -357
  12. package/dist/cli/arguments.js.map +1 -1
  13. package/dist/cli/check-command.d.ts +9 -0
  14. package/dist/cli/check-command.d.ts.map +1 -0
  15. package/dist/cli/check-command.js +95 -0
  16. package/dist/cli/check-command.js.map +1 -0
  17. package/dist/cli/cli-input.d.ts +49 -0
  18. package/dist/cli/cli-input.d.ts.map +1 -0
  19. package/dist/cli/cli-input.js +31 -0
  20. package/dist/cli/cli-input.js.map +1 -0
  21. package/dist/cli/command.d.ts +97 -0
  22. package/dist/cli/command.d.ts.map +1 -0
  23. package/dist/cli/command.js +40 -0
  24. package/dist/cli/command.js.map +1 -0
  25. package/dist/cli/commands.d.ts +7 -110
  26. package/dist/cli/commands.d.ts.map +1 -1
  27. package/dist/cli/commands.js +14 -991
  28. package/dist/cli/commands.js.map +1 -1
  29. package/dist/cli/convert-command.d.ts +6 -0
  30. package/dist/cli/convert-command.d.ts.map +1 -0
  31. package/dist/cli/convert-command.js +52 -0
  32. package/dist/cli/convert-command.js.map +1 -0
  33. package/dist/cli/environment.d.ts +1 -1
  34. package/dist/cli/environment.d.ts.map +1 -1
  35. package/dist/cli/explain-command.d.ts +6 -0
  36. package/dist/cli/explain-command.d.ts.map +1 -0
  37. package/dist/cli/explain-command.js +40 -0
  38. package/dist/cli/explain-command.js.map +1 -0
  39. package/dist/cli/explain-syllable.d.ts +10 -0
  40. package/dist/cli/explain-syllable.d.ts.map +1 -0
  41. package/dist/cli/explain-syllable.js +70 -0
  42. package/dist/cli/explain-syllable.js.map +1 -0
  43. package/dist/cli/flag-help.d.ts +18 -0
  44. package/dist/cli/flag-help.d.ts.map +1 -0
  45. package/dist/cli/flag-help.js +78 -0
  46. package/dist/cli/flag-help.js.map +1 -0
  47. package/dist/cli/flag-lists.d.ts +49 -0
  48. package/dist/cli/flag-lists.d.ts.map +1 -0
  49. package/dist/cli/flag-lists.js +58 -0
  50. package/dist/cli/flag-lists.js.map +1 -0
  51. package/dist/cli/flag-values.d.ts +44 -0
  52. package/dist/cli/flag-values.d.ts.map +1 -0
  53. package/dist/cli/flag-values.js +56 -0
  54. package/dist/cli/flag-values.js.map +1 -0
  55. package/dist/cli/flags.d.ts +193 -0
  56. package/dist/cli/flags.d.ts.map +1 -0
  57. package/dist/cli/flags.js +133 -0
  58. package/dist/cli/flags.js.map +1 -0
  59. package/dist/cli/format-options.d.ts +29 -0
  60. package/dist/cli/format-options.d.ts.map +1 -0
  61. package/dist/cli/format-options.js +72 -0
  62. package/dist/cli/format-options.js.map +1 -0
  63. package/dist/cli/global-help.d.ts +23 -0
  64. package/dist/cli/global-help.d.ts.map +1 -0
  65. package/dist/cli/global-help.js +40 -0
  66. package/dist/cli/global-help.js.map +1 -0
  67. package/dist/cli/help.d.ts +1 -1
  68. package/dist/cli/help.d.ts.map +1 -1
  69. package/dist/cli/help.js +5 -99
  70. package/dist/cli/help.js.map +1 -1
  71. package/dist/cli/html-commands.d.ts +13 -0
  72. package/dist/cli/html-commands.d.ts.map +1 -0
  73. package/dist/cli/html-commands.js +49 -0
  74. package/dist/cli/html-commands.js.map +1 -0
  75. package/dist/cli/info-command.d.ts +7 -0
  76. package/dist/cli/info-command.d.ts.map +1 -0
  77. package/dist/cli/info-command.js +39 -0
  78. package/dist/cli/info-command.js.map +1 -0
  79. package/dist/cli/lookup-commands.d.ts +10 -0
  80. package/dist/cli/lookup-commands.d.ts.map +1 -0
  81. package/dist/cli/lookup-commands.js +101 -0
  82. package/dist/cli/lookup-commands.js.map +1 -0
  83. package/dist/cli/match-command.d.ts +11 -0
  84. package/dist/cli/match-command.d.ts.map +1 -0
  85. package/dist/cli/match-command.js +76 -0
  86. package/dist/cli/match-command.js.map +1 -0
  87. package/dist/cli/number-command.d.ts +12 -0
  88. package/dist/cli/number-command.d.ts.map +1 -0
  89. package/dist/cli/number-command.js +89 -0
  90. package/dist/cli/number-command.js.map +1 -0
  91. package/dist/cli/options.d.ts +30 -0
  92. package/dist/cli/options.d.ts.map +1 -0
  93. package/dist/cli/options.js +54 -0
  94. package/dist/cli/options.js.map +1 -0
  95. package/dist/cli/run-command.d.ts +24 -0
  96. package/dist/cli/run-command.d.ts.map +1 -0
  97. package/dist/cli/run-command.js +40 -0
  98. package/dist/cli/run-command.js.map +1 -0
  99. package/dist/cli/run.d.ts +4 -42
  100. package/dist/cli/run.d.ts.map +1 -1
  101. package/dist/cli/run.js +6 -61
  102. package/dist/cli/run.js.map +1 -1
  103. package/dist/cli/script-command.d.ts +10 -0
  104. package/dist/cli/script-command.d.ts.map +1 -0
  105. package/dist/cli/script-command.js +58 -0
  106. package/dist/cli/script-command.js.map +1 -0
  107. package/dist/cli/segment-command.d.ts +11 -0
  108. package/dist/cli/segment-command.d.ts.map +1 -0
  109. package/dist/cli/segment-command.js +53 -0
  110. package/dist/cli/segment-command.js.map +1 -0
  111. package/dist/cli/slug-command.d.ts +10 -0
  112. package/dist/cli/slug-command.d.ts.map +1 -0
  113. package/dist/cli/slug-command.js +28 -0
  114. package/dist/cli/slug-command.js.map +1 -0
  115. package/dist/cli/syllable-command.d.ts +14 -0
  116. package/dist/cli/syllable-command.d.ts.map +1 -0
  117. package/dist/cli/syllable-command.js +82 -0
  118. package/dist/cli/syllable-command.js.map +1 -0
  119. package/dist/cli/system-table.d.ts +12 -0
  120. package/dist/cli/system-table.d.ts.map +1 -0
  121. package/dist/cli/system-table.js +48 -0
  122. package/dist/cli/system-table.js.map +1 -0
  123. package/dist/cli/systems.d.ts +57 -0
  124. package/dist/cli/systems.d.ts.map +1 -0
  125. package/dist/cli/systems.js +27 -0
  126. package/dist/cli/systems.js.map +1 -0
  127. package/dist/cli/transcribe-command.d.ts +18 -0
  128. package/dist/cli/transcribe-command.d.ts.map +1 -0
  129. package/dist/cli/transcribe-command.js +86 -0
  130. package/dist/cli/transcribe-command.js.map +1 -0
  131. package/dist/cli/transcribe-reading.d.ts +15 -0
  132. package/dist/cli/transcribe-reading.d.ts.map +1 -0
  133. package/dist/cli/transcribe-reading.js +90 -0
  134. package/dist/cli/transcribe-reading.js.map +1 -0
  135. package/dist/cli/transcribe-rows.d.ts +26 -0
  136. package/dist/cli/transcribe-rows.d.ts.map +1 -0
  137. package/dist/cli/transcribe-rows.js +30 -0
  138. package/dist/cli/transcribe-rows.js.map +1 -0
  139. package/dist/cli/usage-error.d.ts +9 -0
  140. package/dist/cli/usage-error.d.ts.map +1 -0
  141. package/dist/cli/usage-error.js +9 -0
  142. package/dist/cli/usage-error.js.map +1 -0
  143. package/dist/decode/alternatives.d.ts +16 -0
  144. package/dist/decode/alternatives.d.ts.map +1 -0
  145. package/dist/decode/alternatives.js +31 -0
  146. package/dist/decode/alternatives.js.map +1 -0
  147. package/dist/decode/confidence.d.ts.map +1 -1
  148. package/dist/decode/confidence.js +3 -118
  149. package/dist/decode/confidence.js.map +1 -1
  150. package/dist/decode/convert-options.d.ts +116 -0
  151. package/dist/decode/convert-options.d.ts.map +1 -0
  152. package/dist/decode/convert-options.js +2 -0
  153. package/dist/decode/convert-options.js.map +1 -0
  154. package/dist/decode/convert-pipeline.d.ts +18 -0
  155. package/dist/decode/convert-pipeline.d.ts.map +1 -0
  156. package/dist/decode/convert-pipeline.js +66 -0
  157. package/dist/decode/convert-pipeline.js.map +1 -0
  158. package/dist/decode/convert.d.ts +9 -118
  159. package/dist/decode/convert.d.ts.map +1 -1
  160. package/dist/decode/convert.js +5 -453
  161. package/dist/decode/convert.js.map +1 -1
  162. package/dist/decode/decode.d.ts +2 -15
  163. package/dist/decode/decode.d.ts.map +1 -1
  164. package/dist/decode/decode.js +2 -121
  165. package/dist/decode/decode.js.map +1 -1
  166. package/dist/decode/decoders.d.ts +32 -0
  167. package/dist/decode/decoders.d.ts.map +1 -0
  168. package/dist/decode/decoders.js +29 -0
  169. package/dist/decode/decoders.js.map +1 -0
  170. package/dist/decode/edge-context.d.ts +38 -0
  171. package/dist/decode/edge-context.d.ts.map +1 -0
  172. package/dist/decode/edge-context.js +57 -0
  173. package/dist/decode/edge-context.js.map +1 -0
  174. package/dist/decode/hint-lattice.d.ts +45 -0
  175. package/dist/decode/hint-lattice.d.ts.map +1 -0
  176. package/dist/decode/hint-lattice.js +140 -0
  177. package/dist/decode/hint-lattice.js.map +1 -0
  178. package/dist/decode/hints.d.ts +2 -45
  179. package/dist/decode/hints.d.ts.map +1 -1
  180. package/dist/decode/hints.js +1 -139
  181. package/dist/decode/hints.js.map +1 -1
  182. package/dist/decode/jiao-rule.d.ts +58 -0
  183. package/dist/decode/jiao-rule.d.ts.map +1 -0
  184. package/dist/decode/jiao-rule.js +76 -0
  185. package/dist/decode/jiao-rule.js.map +1 -0
  186. package/dist/decode/lattice-costs.d.ts +55 -0
  187. package/dist/decode/lattice-costs.d.ts.map +1 -0
  188. package/dist/decode/lattice-costs.js +90 -0
  189. package/dist/decode/lattice-costs.js.map +1 -0
  190. package/dist/decode/lattice-edges.d.ts +29 -0
  191. package/dist/decode/lattice-edges.d.ts.map +1 -0
  192. package/dist/decode/lattice-edges.js +78 -0
  193. package/dist/decode/lattice-edges.js.map +1 -0
  194. package/dist/decode/lattice-slice.d.ts +37 -0
  195. package/dist/decode/lattice-slice.d.ts.map +1 -0
  196. package/dist/decode/lattice-slice.js +43 -0
  197. package/dist/decode/lattice-slice.js.map +1 -0
  198. package/dist/decode/lattice-types.d.ts +82 -0
  199. package/dist/decode/lattice-types.d.ts.map +1 -0
  200. package/dist/decode/lattice-types.js +44 -0
  201. package/dist/decode/lattice-types.js.map +1 -0
  202. package/dist/decode/lattice.d.ts +2 -59
  203. package/dist/decode/lattice.d.ts.map +1 -1
  204. package/dist/decode/lattice.js +2 -118
  205. package/dist/decode/lattice.js.map +1 -1
  206. package/dist/decode/number-pieces.d.ts +62 -0
  207. package/dist/decode/number-pieces.d.ts.map +1 -0
  208. package/dist/decode/number-pieces.js +106 -0
  209. package/dist/decode/number-pieces.js.map +1 -0
  210. package/dist/decode/numbers.d.ts +53 -0
  211. package/dist/decode/numbers.d.ts.map +1 -0
  212. package/dist/decode/numbers.js +69 -0
  213. package/dist/decode/numbers.js.map +1 -0
  214. package/dist/decode/pieces.d.ts +78 -0
  215. package/dist/decode/pieces.d.ts.map +1 -0
  216. package/dist/decode/pieces.js +136 -0
  217. package/dist/decode/pieces.js.map +1 -0
  218. package/dist/decode/polyphone-rules.d.ts +31 -0
  219. package/dist/decode/polyphone-rules.d.ts.map +1 -0
  220. package/dist/decode/polyphone-rules.js +159 -0
  221. package/dist/decode/polyphone-rules.js.map +1 -0
  222. package/dist/decode/reading-rules.d.ts +2 -97
  223. package/dist/decode/reading-rules.d.ts.map +1 -1
  224. package/dist/decode/reading-rules.js +4 -365
  225. package/dist/decode/reading-rules.js.map +1 -1
  226. package/dist/decode/rules.d.ts +1 -17
  227. package/dist/decode/rules.d.ts.map +1 -1
  228. package/dist/decode/rules.js +1 -43
  229. package/dist/decode/rules.js.map +1 -1
  230. package/dist/decode/run-lattice.d.ts +52 -0
  231. package/dist/decode/run-lattice.d.ts.map +1 -0
  232. package/dist/decode/run-lattice.js +91 -0
  233. package/dist/decode/run-lattice.js.map +1 -0
  234. package/dist/decode/sandhi-tones.d.ts +69 -0
  235. package/dist/decode/sandhi-tones.d.ts.map +1 -0
  236. package/dist/decode/sandhi-tones.js +88 -0
  237. package/dist/decode/sandhi-tones.js.map +1 -0
  238. package/dist/decode/sandhi.d.ts +1 -1
  239. package/dist/decode/sandhi.d.ts.map +1 -1
  240. package/dist/decode/sandhi.js +1 -81
  241. package/dist/decode/sandhi.js.map +1 -1
  242. package/dist/decode/script-types.d.ts +76 -0
  243. package/dist/decode/script-types.d.ts.map +1 -0
  244. package/dist/decode/script-types.js +35 -0
  245. package/dist/decode/script-types.js.map +1 -0
  246. package/dist/decode/script-words.d.ts +32 -0
  247. package/dist/decode/script-words.d.ts.map +1 -0
  248. package/dist/decode/script-words.js +77 -0
  249. package/dist/decode/script-words.js.map +1 -0
  250. package/dist/decode/script.d.ts +3 -73
  251. package/dist/decode/script.d.ts.map +1 -1
  252. package/dist/decode/script.js +3 -109
  253. package/dist/decode/script.js.map +1 -1
  254. package/dist/decode/tan-rule.d.ts +68 -0
  255. package/dist/decode/tan-rule.d.ts.map +1 -0
  256. package/dist/decode/tan-rule.js +131 -0
  257. package/dist/decode/tan-rule.js.map +1 -0
  258. package/dist/decode/write-run.d.ts +28 -0
  259. package/dist/decode/write-run.d.ts.map +1 -0
  260. package/dist/decode/write-run.js +77 -0
  261. package/dist/decode/write-run.js.map +1 -0
  262. package/dist/dictionary/artifact-claims.d.ts +25 -0
  263. package/dist/dictionary/artifact-claims.d.ts.map +1 -0
  264. package/dist/dictionary/artifact-claims.js +47 -0
  265. package/dist/dictionary/artifact-claims.js.map +1 -0
  266. package/dist/dictionary/artifact-format.d.ts +86 -0
  267. package/dist/dictionary/artifact-format.d.ts.map +1 -0
  268. package/dist/dictionary/artifact-format.js +91 -0
  269. package/dist/dictionary/artifact-format.js.map +1 -0
  270. package/dist/dictionary/artifact-read.d.ts +34 -0
  271. package/dist/dictionary/artifact-read.d.ts.map +1 -0
  272. package/dist/dictionary/artifact-read.js +114 -0
  273. package/dist/dictionary/artifact-read.js.map +1 -0
  274. package/dist/dictionary/artifact.d.ts +4 -63
  275. package/dist/dictionary/artifact.d.ts.map +1 -1
  276. package/dist/dictionary/artifact.js +12 -229
  277. package/dist/dictionary/artifact.js.map +1 -1
  278. package/dist/dictionary/assertions.d.ts +5 -57
  279. package/dist/dictionary/assertions.d.ts.map +1 -1
  280. package/dist/dictionary/assertions.js +4 -317
  281. package/dist/dictionary/assertions.js.map +1 -1
  282. package/dist/dictionary/build-assertions.d.ts +12 -0
  283. package/dist/dictionary/build-assertions.d.ts.map +1 -0
  284. package/dist/dictionary/build-assertions.js +13 -0
  285. package/dist/dictionary/build-assertions.js.map +1 -0
  286. package/dist/dictionary/built-dictionary.d.ts +46 -0
  287. package/dist/dictionary/built-dictionary.d.ts.map +1 -0
  288. package/dist/dictionary/built-dictionary.js +97 -0
  289. package/dist/dictionary/built-dictionary.js.map +1 -0
  290. package/dist/dictionary/cedict-senses.d.ts +80 -0
  291. package/dist/dictionary/cedict-senses.d.ts.map +1 -0
  292. package/dist/dictionary/cedict-senses.js +114 -0
  293. package/dist/dictionary/cedict-senses.js.map +1 -0
  294. package/dist/dictionary/character-defaults.d.ts +26 -0
  295. package/dist/dictionary/character-defaults.d.ts.map +1 -0
  296. package/dist/dictionary/character-defaults.js +67 -0
  297. package/dist/dictionary/character-defaults.js.map +1 -0
  298. package/dist/dictionary/character-readings.d.ts +10 -0
  299. package/dist/dictionary/character-readings.d.ts.map +1 -0
  300. package/dist/dictionary/character-readings.js +25 -0
  301. package/dist/dictionary/character-readings.js.map +1 -0
  302. package/dist/dictionary/dictionary-entry.d.ts +37 -0
  303. package/dist/dictionary/dictionary-entry.d.ts.map +1 -0
  304. package/dist/dictionary/dictionary-entry.js +41 -0
  305. package/dist/dictionary/dictionary-entry.js.map +1 -0
  306. package/dist/dictionary/dictionary-readings.d.ts +56 -0
  307. package/dist/dictionary/dictionary-readings.d.ts.map +1 -0
  308. package/dist/dictionary/dictionary-readings.js +93 -0
  309. package/dist/dictionary/dictionary-readings.js.map +1 -0
  310. package/dist/dictionary/dictionary.d.ts +6 -60
  311. package/dist/dictionary/dictionary.d.ts.map +1 -1
  312. package/dist/dictionary/dictionary.js +9 -169
  313. package/dist/dictionary/dictionary.js.map +1 -1
  314. package/dist/dictionary/entry-invariants.d.ts +3 -0
  315. package/dist/dictionary/entry-invariants.d.ts.map +1 -0
  316. package/dist/dictionary/entry-invariants.js +67 -0
  317. package/dist/dictionary/entry-invariants.js.map +1 -0
  318. package/dist/dictionary/entry-lines.d.ts +35 -0
  319. package/dist/dictionary/entry-lines.d.ts.map +1 -0
  320. package/dist/dictionary/entry-lines.js +70 -0
  321. package/dist/dictionary/entry-lines.js.map +1 -0
  322. package/dist/dictionary/erhua-repair.d.ts +26 -0
  323. package/dist/dictionary/erhua-repair.d.ts.map +1 -0
  324. package/dist/dictionary/erhua-repair.js +49 -0
  325. package/dist/dictionary/erhua-repair.js.map +1 -0
  326. package/dist/dictionary/frequency-tones.d.ts +74 -0
  327. package/dist/dictionary/frequency-tones.d.ts.map +1 -0
  328. package/dist/dictionary/frequency-tones.js +128 -0
  329. package/dist/dictionary/frequency-tones.js.map +1 -0
  330. package/dist/dictionary/inventory-invariants.d.ts +3 -0
  331. package/dist/dictionary/inventory-invariants.d.ts.map +1 -0
  332. package/dist/dictionary/inventory-invariants.js +54 -0
  333. package/dist/dictionary/inventory-invariants.js.map +1 -0
  334. package/dist/dictionary/locale-candidates.d.ts +40 -0
  335. package/dist/dictionary/locale-candidates.d.ts.map +1 -0
  336. package/dist/dictionary/locale-candidates.js +77 -0
  337. package/dist/dictionary/locale-candidates.js.map +1 -0
  338. package/dist/dictionary/locale-segments.d.ts +47 -0
  339. package/dist/dictionary/locale-segments.d.ts.map +1 -0
  340. package/dist/dictionary/locale-segments.js +141 -0
  341. package/dist/dictionary/locale-segments.js.map +1 -0
  342. package/dist/dictionary/locale.d.ts +1 -21
  343. package/dist/dictionary/locale.d.ts.map +1 -1
  344. package/dist/dictionary/locale.js +9 -198
  345. package/dist/dictionary/locale.js.map +1 -1
  346. package/dist/dictionary/merge-types.d.ts +121 -0
  347. package/dist/dictionary/merge-types.d.ts.map +1 -0
  348. package/dist/dictionary/merge-types.js +35 -0
  349. package/dist/dictionary/merge-types.js.map +1 -0
  350. package/dist/dictionary/merge-word.d.ts +7 -0
  351. package/dist/dictionary/merge-word.d.ts.map +1 -0
  352. package/dist/dictionary/merge-word.js +91 -0
  353. package/dist/dictionary/merge-word.js.map +1 -0
  354. package/dist/dictionary/merge.d.ts +5 -62
  355. package/dist/dictionary/merge.d.ts.map +1 -1
  356. package/dist/dictionary/merge.js +30 -713
  357. package/dist/dictionary/merge.js.map +1 -1
  358. package/dist/dictionary/proper-noun.d.ts +28 -0
  359. package/dist/dictionary/proper-noun.d.ts.map +1 -0
  360. package/dist/dictionary/proper-noun.js +43 -0
  361. package/dist/dictionary/proper-noun.js.map +1 -0
  362. package/dist/dictionary/reading-agreement.d.ts +71 -0
  363. package/dist/dictionary/reading-agreement.d.ts.map +1 -0
  364. package/dist/dictionary/reading-agreement.js +156 -0
  365. package/dist/dictionary/reading-agreement.js.map +1 -0
  366. package/dist/dictionary/script-conversion.d.ts +28 -0
  367. package/dist/dictionary/script-conversion.d.ts.map +1 -0
  368. package/dist/dictionary/script-conversion.js +58 -0
  369. package/dist/dictionary/script-conversion.js.map +1 -0
  370. package/dist/dictionary/script-pairings.d.ts +74 -0
  371. package/dist/dictionary/script-pairings.d.ts.map +1 -0
  372. package/dist/dictionary/script-pairings.js +120 -0
  373. package/dist/dictionary/script-pairings.js.map +1 -0
  374. package/dist/dictionary/script-tables.d.ts.map +1 -1
  375. package/dist/dictionary/script-tables.js +2 -165
  376. package/dist/dictionary/script-tables.js.map +1 -1
  377. package/dist/dictionary/taiwan-reading.d.ts +8 -0
  378. package/dist/dictionary/taiwan-reading.d.ts.map +1 -0
  379. package/dist/dictionary/taiwan-reading.js +38 -0
  380. package/dist/dictionary/taiwan-reading.js.map +1 -0
  381. package/dist/dictionary/tone-invariants.d.ts +3 -0
  382. package/dist/dictionary/tone-invariants.d.ts.map +1 -0
  383. package/dist/dictionary/tone-invariants.js +64 -0
  384. package/dist/dictionary/tone-invariants.js.map +1 -0
  385. package/dist/dictionary/traditional-form.d.ts +21 -0
  386. package/dist/dictionary/traditional-form.d.ts.map +1 -0
  387. package/dist/dictionary/traditional-form.js +59 -0
  388. package/dist/dictionary/traditional-form.js.map +1 -0
  389. package/dist/dictionary/traditional-ranking.d.ts +22 -0
  390. package/dist/dictionary/traditional-ranking.d.ts.map +1 -0
  391. package/dist/dictionary/traditional-ranking.js +74 -0
  392. package/dist/dictionary/traditional-ranking.js.map +1 -0
  393. package/dist/dictionary/traditional-table.d.ts +51 -0
  394. package/dist/dictionary/traditional-table.d.ts.map +1 -0
  395. package/dist/dictionary/traditional-table.js +98 -0
  396. package/dist/dictionary/traditional-table.js.map +1 -0
  397. package/dist/dictionary/traditional.d.ts +3 -56
  398. package/dist/dictionary/traditional.d.ts.map +1 -1
  399. package/dist/dictionary/traditional.js +3 -186
  400. package/dist/dictionary/traditional.js.map +1 -1
  401. package/dist/dictionary/variant-counts.d.ts +39 -0
  402. package/dist/dictionary/variant-counts.d.ts.map +1 -0
  403. package/dist/dictionary/variant-counts.js +38 -0
  404. package/dist/dictionary/variant-counts.js.map +1 -0
  405. package/dist/dictionary/word-reading.d.ts +26 -0
  406. package/dist/dictionary/word-reading.d.ts.map +1 -0
  407. package/dist/dictionary/word-reading.js +76 -0
  408. package/dist/dictionary/word-reading.js.map +1 -0
  409. package/dist/dictionary/word-readings.d.ts +15 -0
  410. package/dist/dictionary/word-readings.d.ts.map +1 -0
  411. package/dist/dictionary/word-readings.js +38 -0
  412. package/dist/dictionary/word-readings.js.map +1 -0
  413. package/dist/format/annotate.d.ts +90 -0
  414. package/dist/format/annotate.d.ts.map +1 -0
  415. package/dist/format/annotate.js +168 -0
  416. package/dist/format/annotate.js.map +1 -0
  417. package/dist/format/html.d.ts +15 -46
  418. package/dist/format/html.d.ts.map +1 -1
  419. package/dist/format/html.js +3 -162
  420. package/dist/format/html.js.map +1 -1
  421. package/dist/format/slug-hash.d.ts +51 -0
  422. package/dist/format/slug-hash.d.ts.map +1 -0
  423. package/dist/format/slug-hash.js +74 -0
  424. package/dist/format/slug-hash.js.map +1 -0
  425. package/dist/format/slug-options.d.ts +98 -0
  426. package/dist/format/slug-options.d.ts.map +1 -0
  427. package/dist/format/slug-options.js +2 -0
  428. package/dist/format/slug-options.js.map +1 -0
  429. package/dist/format/slug-words.d.ts +27 -0
  430. package/dist/format/slug-words.d.ts.map +1 -0
  431. package/dist/format/slug-words.js +0 -0
  432. package/dist/format/slug-words.js.map +1 -0
  433. package/dist/format/slug.d.ts +3 -128
  434. package/dist/format/slug.d.ts.map +1 -1
  435. package/dist/format/slug.js +0 -0
  436. package/dist/format/slug.js.map +1 -1
  437. package/dist/grade/check-readings.d.ts +41 -0
  438. package/dist/grade/check-readings.d.ts.map +1 -0
  439. package/dist/grade/check-readings.js +36 -0
  440. package/dist/grade/check-readings.js.map +1 -0
  441. package/dist/grade/check.d.ts +4 -4
  442. package/dist/grade/check.d.ts.map +1 -1
  443. package/dist/grade/check.js +5 -270
  444. package/dist/grade/check.js.map +1 -1
  445. package/dist/grade/pair-syllables.d.ts +48 -0
  446. package/dist/grade/pair-syllables.d.ts.map +1 -0
  447. package/dist/grade/pair-syllables.js +71 -0
  448. package/dist/grade/pair-syllables.js.map +1 -0
  449. package/dist/grade/reading-syllables.d.ts +62 -0
  450. package/dist/grade/reading-syllables.d.ts.map +1 -0
  451. package/dist/grade/reading-syllables.js +58 -0
  452. package/dist/grade/reading-syllables.js.map +1 -0
  453. package/dist/grade/reading-tolerance.d.ts +72 -0
  454. package/dist/grade/reading-tolerance.d.ts.map +1 -0
  455. package/dist/grade/reading-tolerance.js +107 -0
  456. package/dist/grade/reading-tolerance.js.map +1 -0
  457. package/dist/grade/typed-reading.d.ts +28 -0
  458. package/dist/grade/typed-reading.d.ts.map +1 -0
  459. package/dist/grade/typed-reading.js +36 -0
  460. package/dist/grade/typed-reading.js.map +1 -0
  461. package/dist/numerals/numeral-parse.d.ts +32 -0
  462. package/dist/numerals/numeral-parse.d.ts.map +1 -0
  463. package/dist/numerals/numeral-parse.js +44 -0
  464. package/dist/numerals/numeral-parse.js.map +1 -0
  465. package/dist/numerals/numeral-shapes.d.ts +89 -0
  466. package/dist/numerals/numeral-shapes.d.ts.map +1 -0
  467. package/dist/numerals/numeral-shapes.js +99 -0
  468. package/dist/numerals/numeral-shapes.js.map +1 -0
  469. package/dist/numerals/numerals.d.ts.map +1 -1
  470. package/dist/numerals/numerals.js +2 -36
  471. package/dist/numerals/numerals.js.map +1 -1
  472. package/dist/numerals/read-numeral.d.ts +76 -0
  473. package/dist/numerals/read-numeral.d.ts.map +1 -0
  474. package/dist/numerals/read-numeral.js +88 -0
  475. package/dist/numerals/read-numeral.js.map +1 -0
  476. package/dist/numerals/text.d.ts +3 -37
  477. package/dist/numerals/text.d.ts.map +1 -1
  478. package/dist/numerals/text.js +3 -254
  479. package/dist/numerals/text.js.map +1 -1
  480. package/dist/numerals/time.d.ts +34 -0
  481. package/dist/numerals/time.d.ts.map +1 -0
  482. package/dist/numerals/time.js +93 -0
  483. package/dist/numerals/time.js.map +1 -0
  484. package/dist/orthography/address-grouping.d.ts +34 -0
  485. package/dist/orthography/address-grouping.d.ts.map +1 -0
  486. package/dist/orthography/address-grouping.js +52 -0
  487. package/dist/orthography/address-grouping.js.map +1 -0
  488. package/dist/orthography/grouping.d.ts +3 -87
  489. package/dist/orthography/grouping.d.ts.map +1 -1
  490. package/dist/orthography/grouping.js +4 -270
  491. package/dist/orthography/grouping.js.map +1 -1
  492. package/dist/orthography/place-grouping.d.ts +39 -0
  493. package/dist/orthography/place-grouping.d.ts.map +1 -0
  494. package/dist/orthography/place-grouping.js +83 -0
  495. package/dist/orthography/place-grouping.js.map +1 -0
  496. package/dist/orthography/word-grouping.d.ts +48 -0
  497. package/dist/orthography/word-grouping.d.ts.map +1 -0
  498. package/dist/orthography/word-grouping.js +147 -0
  499. package/dist/orthography/word-grouping.js.map +1 -0
  500. package/dist/script/conversion-format.d.ts +22 -0
  501. package/dist/script/conversion-format.d.ts.map +1 -0
  502. package/dist/script/conversion-format.js +22 -0
  503. package/dist/script/conversion-format.js.map +1 -0
  504. package/dist/script/conversion-read.d.ts +9 -0
  505. package/dist/script/conversion-read.d.ts.map +1 -0
  506. package/dist/script/conversion-read.js +69 -0
  507. package/dist/script/conversion-read.js.map +1 -0
  508. package/dist/script/conversion-write.d.ts +14 -0
  509. package/dist/script/conversion-write.d.ts.map +1 -0
  510. package/dist/script/conversion-write.js +34 -0
  511. package/dist/script/conversion-write.js.map +1 -0
  512. package/dist/script/conversion.d.ts +10 -16
  513. package/dist/script/conversion.d.ts.map +1 -1
  514. package/dist/script/conversion.js +2 -115
  515. package/dist/script/conversion.js.map +1 -1
  516. package/dist/search/candidate-narrowing.d.ts +56 -0
  517. package/dist/search/candidate-narrowing.d.ts.map +1 -0
  518. package/dist/search/candidate-narrowing.js +55 -0
  519. package/dist/search/candidate-narrowing.js.map +1 -0
  520. package/dist/search/candidate-query.d.ts +25 -0
  521. package/dist/search/candidate-query.d.ts.map +1 -0
  522. package/dist/search/candidate-query.js +28 -0
  523. package/dist/search/candidate-query.js.map +1 -0
  524. package/dist/search/candidate-writings.d.ts +24 -0
  525. package/dist/search/candidate-writings.d.ts.map +1 -0
  526. package/dist/search/candidate-writings.js +114 -0
  527. package/dist/search/candidate-writings.js.map +1 -0
  528. package/dist/search/candidates.d.ts +7 -41
  529. package/dist/search/candidates.d.ts.map +1 -1
  530. package/dist/search/candidates.js +10 -164
  531. package/dist/search/candidates.js.map +1 -1
  532. package/dist/search/match-chunks.d.ts +19 -0
  533. package/dist/search/match-chunks.d.ts.map +1 -0
  534. package/dist/search/match-chunks.js +30 -0
  535. package/dist/search/match-chunks.js.map +1 -0
  536. package/dist/search/match-ranking.d.ts +39 -0
  537. package/dist/search/match-ranking.d.ts.map +1 -0
  538. package/dist/search/match-ranking.js +51 -0
  539. package/dist/search/match-ranking.js.map +1 -0
  540. package/dist/search/match-readings.d.ts +43 -0
  541. package/dist/search/match-readings.d.ts.map +1 -0
  542. package/dist/search/match-readings.js +83 -0
  543. package/dist/search/match-readings.js.map +1 -0
  544. package/dist/search/match-scoring.d.ts +146 -0
  545. package/dist/search/match-scoring.d.ts.map +1 -0
  546. package/dist/search/match-scoring.js +114 -0
  547. package/dist/search/match-scoring.js.map +1 -0
  548. package/dist/search/match-search.d.ts +28 -0
  549. package/dist/search/match-search.d.ts.map +1 -0
  550. package/dist/search/match-search.js +128 -0
  551. package/dist/search/match-search.js.map +1 -0
  552. package/dist/search/match.d.ts +5 -36
  553. package/dist/search/match.d.ts.map +1 -1
  554. package/dist/search/match.js +2 -379
  555. package/dist/search/match.js.map +1 -1
  556. package/dist/search/reverse-index-build.d.ts +30 -0
  557. package/dist/search/reverse-index-build.d.ts.map +1 -0
  558. package/dist/search/reverse-index-build.js +72 -0
  559. package/dist/search/reverse-index-build.js.map +1 -0
  560. package/dist/search/reverse-index-format.d.ts +60 -0
  561. package/dist/search/reverse-index-format.d.ts.map +1 -0
  562. package/dist/search/reverse-index-format.js +54 -0
  563. package/dist/search/reverse-index-format.js.map +1 -0
  564. package/dist/search/reverse-index-groups.d.ts +37 -0
  565. package/dist/search/reverse-index-groups.d.ts.map +1 -0
  566. package/dist/search/reverse-index-groups.js +71 -0
  567. package/dist/search/reverse-index-groups.js.map +1 -0
  568. package/dist/search/reverse-index-passes.d.ts +78 -0
  569. package/dist/search/reverse-index-passes.d.ts.map +1 -0
  570. package/dist/search/reverse-index-passes.js +59 -0
  571. package/dist/search/reverse-index-passes.js.map +1 -0
  572. package/dist/search/reverse-index-state.d.ts +36 -0
  573. package/dist/search/reverse-index-state.d.ts.map +1 -0
  574. package/dist/search/reverse-index-state.js +95 -0
  575. package/dist/search/reverse-index-state.js.map +1 -0
  576. package/dist/search/reverse-index.d.ts +8 -67
  577. package/dist/search/reverse-index.d.ts.map +1 -1
  578. package/dist/search/reverse-index.js +4 -255
  579. package/dist/search/reverse-index.js.map +1 -1
  580. package/dist/sources/unihan-readings.d.ts +58 -0
  581. package/dist/sources/unihan-readings.d.ts.map +1 -0
  582. package/dist/sources/unihan-readings.js +95 -0
  583. package/dist/sources/unihan-readings.js.map +1 -0
  584. package/dist/sources/unihan.d.ts +6 -9
  585. package/dist/sources/unihan.d.ts.map +1 -1
  586. package/dist/sources/unihan.js +2 -85
  587. package/dist/sources/unihan.js.map +1 -1
  588. package/dist/syllable/final-tables.d.ts +23 -0
  589. package/dist/syllable/final-tables.d.ts.map +1 -0
  590. package/dist/syllable/final-tables.js +50 -0
  591. package/dist/syllable/final-tables.js.map +1 -0
  592. package/dist/syllable/inventory.d.ts +8 -42
  593. package/dist/syllable/inventory.d.ts.map +1 -1
  594. package/dist/syllable/inventory.js +9 -918
  595. package/dist/syllable/inventory.js.map +1 -1
  596. package/dist/syllable/spellings.d.ts +40 -0
  597. package/dist/syllable/spellings.d.ts.map +1 -0
  598. package/dist/syllable/spellings.js +469 -0
  599. package/dist/syllable/spellings.js.map +1 -0
  600. package/dist/syllable/syllable-parts.d.ts +31 -0
  601. package/dist/syllable/syllable-parts.d.ts.map +1 -0
  602. package/dist/syllable/syllable-parts.js +105 -0
  603. package/dist/syllable/syllable-parts.js.map +1 -0
  604. package/dist/syllable/syllable.d.ts +1 -14
  605. package/dist/syllable/syllable.d.ts.map +1 -1
  606. package/dist/syllable/syllable.js +3 -144
  607. package/dist/syllable/syllable.js.map +1 -1
  608. package/dist/syllable/written-tones.d.ts +6 -0
  609. package/dist/syllable/written-tones.d.ts.map +1 -0
  610. package/dist/syllable/written-tones.js +453 -0
  611. package/dist/syllable/written-tones.js.map +1 -0
  612. package/dist/transcription/bopomofo-parse.d.ts +42 -0
  613. package/dist/transcription/bopomofo-parse.d.ts.map +1 -0
  614. package/dist/transcription/bopomofo-parse.js +92 -0
  615. package/dist/transcription/bopomofo-parse.js.map +1 -0
  616. package/dist/transcription/bopomofo-reverse.d.ts +31 -0
  617. package/dist/transcription/bopomofo-reverse.d.ts.map +1 -0
  618. package/dist/transcription/bopomofo-reverse.js +48 -0
  619. package/dist/transcription/bopomofo-reverse.js.map +1 -0
  620. package/dist/transcription/bopomofo-symbols.d.ts +36 -0
  621. package/dist/transcription/bopomofo-symbols.d.ts.map +1 -0
  622. package/dist/transcription/bopomofo-symbols.js +41 -0
  623. package/dist/transcription/bopomofo-symbols.js.map +1 -0
  624. package/dist/transcription/bopomofo-tables.d.ts +87 -0
  625. package/dist/transcription/bopomofo-tables.d.ts.map +1 -0
  626. package/dist/transcription/bopomofo-tables.js +180 -0
  627. package/dist/transcription/bopomofo-tables.js.map +1 -0
  628. package/dist/transcription/bopomofo.d.ts +14 -32
  629. package/dist/transcription/bopomofo.d.ts.map +1 -1
  630. package/dist/transcription/bopomofo.js +5 -343
  631. package/dist/transcription/bopomofo.js.map +1 -1
  632. package/dist/transcription/gwoyeu-first-second.d.ts +36 -0
  633. package/dist/transcription/gwoyeu-first-second.d.ts.map +1 -0
  634. package/dist/transcription/gwoyeu-first-second.js +75 -0
  635. package/dist/transcription/gwoyeu-first-second.js.map +1 -0
  636. package/dist/transcription/gwoyeu-spelling.d.ts +38 -0
  637. package/dist/transcription/gwoyeu-spelling.d.ts.map +1 -0
  638. package/dist/transcription/gwoyeu-spelling.js +124 -0
  639. package/dist/transcription/gwoyeu-spelling.js.map +1 -0
  640. package/dist/transcription/gwoyeu-tables.d.ts +93 -0
  641. package/dist/transcription/gwoyeu-tables.d.ts.map +1 -0
  642. package/dist/transcription/gwoyeu-tables.js +205 -0
  643. package/dist/transcription/gwoyeu-tables.js.map +1 -0
  644. package/dist/transcription/gwoyeu-tonal-forms.d.ts +49 -0
  645. package/dist/transcription/gwoyeu-tonal-forms.d.ts.map +1 -0
  646. package/dist/transcription/gwoyeu-tonal-forms.js +89 -0
  647. package/dist/transcription/gwoyeu-tonal-forms.js.map +1 -0
  648. package/dist/transcription/gwoyeu-vowels.d.ts +51 -0
  649. package/dist/transcription/gwoyeu-vowels.d.ts.map +1 -0
  650. package/dist/transcription/gwoyeu-vowels.js +58 -0
  651. package/dist/transcription/gwoyeu-vowels.js.map +1 -0
  652. package/dist/transcription/gwoyeu.d.ts +1 -26
  653. package/dist/transcription/gwoyeu.d.ts.map +1 -1
  654. package/dist/transcription/gwoyeu.js +2 -540
  655. package/dist/transcription/gwoyeu.js.map +1 -1
  656. package/dist/transcription/ipa-symbols.d.ts +67 -0
  657. package/dist/transcription/ipa-symbols.d.ts.map +1 -0
  658. package/dist/transcription/ipa-symbols.js +135 -0
  659. package/dist/transcription/ipa-symbols.js.map +1 -0
  660. package/dist/transcription/ipa.d.ts +2 -10
  661. package/dist/transcription/ipa.d.ts.map +1 -1
  662. package/dist/transcription/ipa.js +2 -134
  663. package/dist/transcription/ipa.js.map +1 -1
  664. package/dist/transcription/wade-giles-index.d.ts +35 -0
  665. package/dist/transcription/wade-giles-index.d.ts.map +1 -0
  666. package/dist/transcription/wade-giles-index.js +110 -0
  667. package/dist/transcription/wade-giles-index.js.map +1 -0
  668. package/dist/transcription/wade-giles-parse.d.ts +36 -0
  669. package/dist/transcription/wade-giles-parse.d.ts.map +1 -0
  670. package/dist/transcription/wade-giles-parse.js +84 -0
  671. package/dist/transcription/wade-giles-parse.js.map +1 -0
  672. package/dist/transcription/wade-giles-spelling.d.ts +61 -0
  673. package/dist/transcription/wade-giles-spelling.d.ts.map +1 -0
  674. package/dist/transcription/wade-giles-spelling.js +107 -0
  675. package/dist/transcription/wade-giles-spelling.js.map +1 -0
  676. package/dist/transcription/wade-giles-syllable.d.ts +29 -0
  677. package/dist/transcription/wade-giles-syllable.d.ts.map +1 -0
  678. package/dist/transcription/wade-giles-syllable.js +90 -0
  679. package/dist/transcription/wade-giles-syllable.js.map +1 -0
  680. package/dist/transcription/wade-giles-tables.d.ts +80 -0
  681. package/dist/transcription/wade-giles-tables.d.ts.map +1 -0
  682. package/dist/transcription/wade-giles-tables.js +178 -0
  683. package/dist/transcription/wade-giles-tables.js.map +1 -0
  684. package/dist/transcription/wade-giles.d.ts +9 -60
  685. package/dist/transcription/wade-giles.d.ts.map +1 -1
  686. package/dist/transcription/wade-giles.js +6 -543
  687. package/dist/transcription/wade-giles.js.map +1 -1
  688. package/dist/transcription/yale-tables.d.ts +54 -0
  689. package/dist/transcription/yale-tables.d.ts.map +1 -0
  690. package/dist/transcription/yale-tables.js +125 -0
  691. package/dist/transcription/yale-tables.js.map +1 -0
  692. package/dist/transcription/yale.d.ts.map +1 -1
  693. package/dist/transcription/yale.js +1 -124
  694. package/dist/transcription/yale.js.map +1 -1
  695. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"slug.js","sourceRoot":"","sources":["../../src/format/slug.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,GAEtB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAiB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA4FvE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAE9B;;;;;;;;;;;GAWG;AACH,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB;;GAEG;AACH,MAAM,eAAe,GAAG,cAAc,CAAC;AAEvC;;GAEG;AACH,MAAM,eAAe,GAAG,UAAU,CAAC;AAEnC;;;;;;;GAOG;AACH,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI;SACR,WAAW,EAAE;SACb,SAAS,CAAC,KAAK,CAAC;SAChB,UAAU,CAAC,eAAe,EAAE,EAAE,CAAC;SAC/B,UAAU,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,QAAgB,EAAE,MAAkB;IACvD,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;AAChD,CAA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AAE,GAAG,OAAO,CAAC;IAC9D,MAAM,MAAM,GAAG,qBAAqB,CAAC,UAAU,EAAE,IAAI,EAAE;QACrD,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QAC/D,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QAC/D,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,MAAM;QAClC,0EAA0E;QAC1E,yEAAyE;QACzE,2DAA2D;QAC3D,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,MAAM;KACpB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,MAAM,MAAM,GACV,SAAS,KAAK,SAAS;QACrB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAEjD,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACjD,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AACzC,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The reading this library produces for a text, as the checker compares it.
3
+ *
4
+ * One of the two sides `check.ts` pairs up; `typed-reading.ts` is the other.
5
+ * They are separate because they are reduced from different things — this from
6
+ * a conversion, that from a string somebody typed — and meet only in being the
7
+ * same shape, a syllable at a time with what was on offer beside it.
8
+ */
9
+ import type { ConvertOptions } from "../decode/convert.js";
10
+ import type { Dictionary } from "../dictionary/dictionary.js";
11
+ import type { Syllable } from "../syllable/syllable.js";
12
+ import type { Tone } from "../tone/tone.js";
13
+ /**
14
+ * An expected syllable, with everything a typed one is allowed to be.
15
+ */
16
+ export interface ExpectedSyllable {
17
+ readonly syllable: Syllable;
18
+ /**
19
+ * Which tones each acceptable spelling may carry.
20
+ *
21
+ * Keyed by the toneless spelling, because the two questions a verdict asks
22
+ * are separate: an unknown spelling is the wrong syllable, and a known
23
+ * spelling with an unlisted tone is the right syllable in the wrong tone.
24
+ */
25
+ readonly accepted: ReadonlyMap<string, ReadonlySet<Tone | undefined>>;
26
+ /** Whether a word may begin here. */
27
+ readonly acceptsBreak: boolean;
28
+ /** Whether this may be written on to the syllable before it. */
29
+ readonly acceptsJoin: boolean;
30
+ readonly source: string | undefined;
31
+ readonly at: number;
32
+ }
33
+ /**
34
+ * Read the text, and work out what a typed syllable is allowed to be.
35
+ *
36
+ * The three conversions each answer a different question; see
37
+ * {@link readingsThreeWays}. What is left here is putting one syllable's worth
38
+ * of all three together.
39
+ */
40
+ export declare function expectedReading(dictionary: Dictionary, text: string, options: ConvertOptions): readonly ExpectedSyllable[];
41
+ //# sourceMappingURL=check-readings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-readings.d.ts","sourceRoot":"","sources":["../../src/grade/check-readings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAO5C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;IACtE,qCAAqC;IACrC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,SAAS,gBAAgB,EAAE,CA+B7B"}
@@ -0,0 +1,36 @@
1
+ import { acceptedReadings, readingsThreeWays, rejectedReadings, } from "./reading-tolerance.js";
2
+ /**
3
+ * Read the text, and work out what a typed syllable is allowed to be.
4
+ *
5
+ * The three conversions each answer a different question; see
6
+ * {@link readingsThreeWays}. What is left here is putting one syllable's worth
7
+ * of all three together.
8
+ */
9
+ export function expectedReading(dictionary, text, options) {
10
+ const { written, said, spaced } = readingsThreeWays(dictionary, text, options);
11
+ return written.map(({ piece, at, junction }, index) => {
12
+ // Sliced rather than indexed, so that a conversion somehow reporting fewer
13
+ // syllables than the others contributes nothing rather than needing a
14
+ // fallback: the caller's own conversion decides alone.
15
+ const alternate = said
16
+ .slice(index, index + 1)
17
+ .map((one) => one.piece.syllable);
18
+ const other = spaced.slice(index, index + 1).map((one) => one.junction);
19
+ return {
20
+ syllable: piece.syllable,
21
+ accepted: acceptedReadings([
22
+ piece.syllable,
23
+ ...alternate,
24
+ ...rejectedReadings(piece),
25
+ ]),
26
+ // A hyphen is neither a break nor a join, and so allows both: it is a
27
+ // boundary the standard writes inside a word, and a learner rendering it
28
+ // as a space has not invented one.
29
+ acceptsBreak: junction !== "join" || other.some((one) => one !== "join"),
30
+ acceptsJoin: junction !== "break" || other.some((one) => one !== "break"),
31
+ source: piece.source,
32
+ at,
33
+ };
34
+ });
35
+ }
36
+ //# sourceMappingURL=check-readings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-readings.js","sourceRoot":"","sources":["../../src/grade/check-readings.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAuBhC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAsB,EACtB,IAAY,EACZ,OAAuB;IAEvB,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,iBAAiB,CACjD,UAAU,EACV,IAAI,EACJ,OAAO,CACR,CAAC;IAEF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE;QACpD,2EAA2E;QAC3E,sEAAsE;QACtE,uDAAuD;QACvD,MAAM,SAAS,GAAG,IAAI;aACnB,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC;aACvB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxE,OAAO;YACL,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,gBAAgB,CAAC;gBACzB,KAAK,CAAC,QAAQ;gBACd,GAAG,SAAS;gBACZ,GAAG,gBAAgB,CAAC,KAAK,CAAC;aAC3B,CAAC;YACF,sEAAsE;YACtE,yEAAyE;YACzE,mCAAmC;YACnC,YAAY,EAAE,QAAQ,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,MAAM,CAAC;YACxE,WAAW,EAAE,QAAQ,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,OAAO,CAAC;YACzE,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,EAAE;SACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type ConvertOptions } from "../decode/convert.js";
1
+ import type { ConvertOptions } from "../decode/convert.js";
2
2
  import type { Dictionary } from "../dictionary/dictionary.js";
3
3
  import { type Syllable } from "../syllable/syllable.js";
4
4
  /**
@@ -80,8 +80,8 @@ export interface CheckedSyllable {
80
80
  * The characters the expected syllable reads.
81
81
  *
82
82
  * Undefined where a syllable reads on into the characters named before it,
83
- * exactly as {@link ConvertedPiece.source} is, and where nothing was
84
- * expected at all.
83
+ * exactly as {@link import("../decode/convert.js").ConvertedPiece.source}
84
+ * is, and where nothing was expected at all.
85
85
  */
86
86
  readonly source: string | undefined;
87
87
  /**
@@ -127,7 +127,7 @@ export interface PinyinCheck {
127
127
  * and both parse, so `bei3jīng` is not a spelling mistake.
128
128
  * - **A reading the decoder itself was unsure of.** Where another reading of
129
129
  * the same character was there for the taking, it is accepted — see
130
- * {@link rejectedReadings}. 银行 is not one of those: the word settles both
130
+ * {@link import("./reading-tolerance.js").rejectedReadings}. 银行 is not one of those: the word settles both
131
131
  * syllables, so `yínxíng` really is wrong.
132
132
  * - **Sandhi either way.** 你好 is written `nǐ hǎo` and said `ní hǎo`, and 不是
133
133
  * is `bú shì` written and `bù shì` underneath. Both pass.
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/grade/check.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,sBAAsB,CA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C;IAChC;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,CAAC;IAC7C,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;IACxC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IACtC,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,EAAE,CAAC;CACvC;AAkDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,KAAK,CACnB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,YAAiB,GACzB,WAAW,CAuBb"}
@@ -1,272 +1,7 @@
1
- import { alignSequences } from "../accuracy/align.js";
2
- import { tokenisePinyin } from "../accuracy/tokenise.js";
3
- import { convertPieces, convertPiecesUnscored, } from "../decode/convert.js";
4
- import { READING_CHARGE } from "../decode/lattice.js";
5
- import { toCharacters } from "../script/characters.js";
6
- import { readSyllable, writeSyllableSpelling, } from "../syllable/syllable.js";
7
- import { NEUTRAL_TONE } from "../tone/tone.js";
8
- /**
9
- * The other corner of the sandhi square.
10
- *
11
- * A learner may write the underlying tones or the tones actually said, and both
12
- * are right — 你好 is written `nǐ hǎo` and said `ní hǎo`. Rather than convert
13
- * four times for the four combinations of {@link SandhiOptions}, this converts
14
- * twice and inverts both switches at once, which reaches every tone: 一 and 不
15
- * sandhi applies to syllables in the first and fourth tones, third-tone sandhi
16
- * only to syllables in the third, so the two passes never touch the same
17
- * syllable and each one's two forms both appear across the two corners.
18
- */
19
- function oppositeSandhi(sandhi) {
20
- return {
21
- yiBu: !(sandhi?.yiBu ?? true),
22
- thirdTone: !(sandhi?.thirdTone ?? false),
23
- };
24
- }
25
- /**
26
- * Where each piece's source characters start, in code points.
27
- *
28
- * Read off the sources rather than tracked through the conversion, which works
29
- * because every character of the text is named by exactly one piece — a piece
30
- * naming none is either pinyin orthography the source has no trace of, such as
31
- * the space between two words, or a syllable reading on into the characters the
32
- * piece before it named.
33
- */
34
- function sourcePositions(pieces) {
35
- const positions = [];
36
- let at = 0;
37
- for (const piece of pieces) {
38
- positions.push(at);
39
- at += toCharacters(piece.source ?? "").length;
40
- }
41
- return positions;
42
- }
43
- /**
44
- * What a piece written between two syllables makes of the join.
45
- *
46
- * Only a hyphen written where the syllables would otherwise have run together
47
- * is 分词连写's internal boundary; anything else — a space, punctuation, a
48
- * stretch that was never Han — separates two words.
49
- */
50
- function junctionOver(text, held) {
51
- return text === "-" && held === "join" ? "hyphen" : "break";
52
- }
53
- /**
54
- * The syllables a conversion writes, with their positions and what joins them.
55
- *
56
- * A conversion writes its syllables as adjacent pieces within a word — the
57
- * 隔音符号 is part of a syllable's own spelling rather than a piece of its own —
58
- * so anything standing between two of them is a boundary, and the hyphen of
59
- * 分词连写 is the one that is not a word boundary.
60
- */
61
- function readingSyllables(pieces) {
62
- const positions = sourcePositions(pieces);
63
- const syllables = [];
64
- // The first syllable of a text begins a word, whatever comes before it.
65
- let junction = "break";
66
- for (const [at, piece] of pieces.entries()) {
67
- if (piece.syllable === undefined) {
68
- junction = junctionOver(piece.text, junction);
69
- continue;
70
- }
71
- syllables.push({
72
- piece: { ...piece, syllable: piece.syllable },
73
- /* c8 ignore next -- one position is recorded for each piece there is */
74
- at: positions[at] ?? 0,
75
- junction,
76
- });
77
- junction = "join";
78
- }
79
- return syllables;
80
- }
81
- /**
82
- * The readings the decode turned down without much reason to.
83
- *
84
- * The decode charges {@link READING_CHARGE} for a word boundary, so a rejected
85
- * reading costing less than that was available without breaking any dictionary
86
- * word apart — see {@link import("../decode/confidence.js").isUncertain}, which
87
- * is the same threshold read as a question rather than as a filter. The library
88
- * knows it was guessing there, so a learner who guessed the other way is not
89
- * wrong.
90
- *
91
- * Only a rejected reading of exactly the one character this syllable reads is
92
- * taken. An alternative can cover a different stretch — 玩儿 read as `wánr`
93
- * competes with 玩 `wán` and 儿 `ér` — and a claim about other characters says
94
- * nothing about what belongs in this position.
95
- */
96
- function rejectedReadings(piece) {
97
- const { confidence, source } = piece;
98
- if (source === undefined || toCharacters(source).length !== 1) {
99
- return [];
100
- }
101
- return (confidence?.alternatives ?? []).flatMap((alternative) => {
102
- const [syllable] = alternative.reading;
103
- return alternative.cost < READING_CHARGE &&
104
- alternative.to - alternative.from === 1 &&
105
- alternative.reading.length === 1 &&
106
- syllable !== undefined
107
- ? [syllable]
108
- : [];
109
- });
110
- }
111
- /**
112
- * Gather readings into the spellings and tones they allow.
113
- *
114
- * The tone is allowed to be undefined only because {@link Syllable.tone} is: a
115
- * reading that came out of the dictionary always carries one.
116
- */
117
- function acceptedReadings(readings) {
118
- const accepted = new Map();
119
- for (const syllable of readings) {
120
- const base = writeSyllableSpelling(syllable);
121
- const tones = accepted.get(base) ?? new Set();
122
- tones.add(syllable.tone);
123
- accepted.set(base, tones);
124
- }
125
- return accepted;
126
- }
127
- /**
128
- * Read the text, and work out what a typed syllable is allowed to be.
129
- *
130
- * Three conversions of the same text, and each one answers a different question.
131
- * The first is the answer itself, with the confidence report beside it. The
132
- * second is the other corner of the sandhi square, which is where the second
133
- * form of every tone comes from. The third is the same text written under the
134
- * other spacing convention, which is where a boundary's tolerance comes from:
135
- * 分词连写 is what puts 了 on its verb and separates 市 from 南京, and a learner
136
- * who wrote the words the dictionary knows instead — `tā kàn le`, `Nánjīngshì`
137
- * — has written one of the two conventions this package implements rather than
138
- * made a mistake.
139
- *
140
- * All three decode identically. Sandhi rewrites tones and 分词连写 moves
141
- * boundaries; neither touches the syllables underneath, so all three line up one
142
- * for one.
143
- */
144
- function expectedReading(dictionary, text, options) {
145
- const written = readingSyllables(convertPieces(dictionary, text, options));
146
- const said = readingSyllables(convertPiecesUnscored(dictionary, text, {
147
- ...options,
148
- sandhi: oppositeSandhi(options.sandhi),
149
- }));
150
- const spaced = readingSyllables(convertPiecesUnscored(dictionary, text, {
151
- ...options,
152
- grouping: !(options.grouping ?? true),
153
- }));
154
- return written.map(({ piece, at, junction }, index) => {
155
- // Sliced rather than indexed, so that a conversion somehow reporting fewer
156
- // syllables than the others contributes nothing rather than needing a
157
- // fallback: the caller's own conversion decides alone.
158
- const alternate = said
159
- .slice(index, index + 1)
160
- .map((one) => one.piece.syllable);
161
- const other = spaced.slice(index, index + 1).map((one) => one.junction);
162
- return {
163
- syllable: piece.syllable,
164
- accepted: acceptedReadings([
165
- piece.syllable,
166
- ...alternate,
167
- ...rejectedReadings(piece),
168
- ]),
169
- // A hyphen is neither a break nor a join, and so allows both: it is a
170
- // boundary the standard writes inside a word, and a learner rendering it
171
- // as a space has not invented one.
172
- acceptsBreak: junction !== "join" || other.some((one) => one !== "join"),
173
- acceptsJoin: junction !== "break" || other.some((one) => one !== "break"),
174
- source: piece.source,
175
- at,
176
- };
177
- });
178
- }
179
- /**
180
- * Read what was typed, one syllable at a time.
181
- *
182
- * {@link tokenisePinyin} is what the decoder is scored with, and it is tolerant
183
- * in the two ways that matter here: word spacing is discarded, and the
184
- * apostrophes and hyphens inside a word are read as the syllable boundaries
185
- * they are and dropped. Both are orthography rather than pronunciation.
186
- *
187
- * A stretch that is not pinyin at all comes back whole, and is reported as
188
- * written rather than thrown away.
189
- */
190
- function typedReading(typed) {
191
- const { syllables, wordStarts } = tokenisePinyin(typed);
192
- return syllables.map((text, at) => {
193
- const syllable = readSyllable(text);
194
- return {
195
- text,
196
- syllable,
197
- base: syllable === undefined
198
- ? text.toLowerCase().normalize("NFC")
199
- : writeSyllableSpelling(syllable),
200
- tone: syllable?.tone,
201
- startsWord: wordStarts.has(at),
202
- };
203
- });
204
- }
205
- /**
206
- * Match the expected syllables up with the typed ones.
207
- *
208
- * Aligned on the toneless spellings, for the reason
209
- * {@link import("../accuracy/score.js").scoreCase} aligns on them: a syllable
210
- * dropped or invented halfway through would otherwise knock everything after it
211
- * out of step, and be reported as a mistake on every syllable rather than on
212
- * the one.
213
- *
214
- * What the alignment leaves over is then paired off within each gap, which is
215
- * what turns two unrelated stretches into substitutions: 银行 typed `yínxíng`
216
- * anchors on `yín`, leaving one expected `háng` against one typed `xíng` — one
217
- * wrong syllable rather than one missing and one invented.
218
- */
219
- function pairSyllables(expected, actual) {
220
- const pairs = [];
221
- let held = 0;
222
- let typed = 0;
223
- const gap = (untilExpected, untilActual) => {
224
- while (held < untilExpected || typed < untilActual) {
225
- const takesExpected = held < untilExpected;
226
- const takesActual = typed < untilActual;
227
- pairs.push({
228
- expected: takesExpected ? held : undefined,
229
- actual: takesActual ? typed : undefined,
230
- });
231
- held += takesExpected ? 1 : 0;
232
- typed += takesActual ? 1 : 0;
233
- }
234
- };
235
- for (const anchor of alignSequences(expected, actual)) {
236
- gap(anchor.expected, anchor.actual);
237
- pairs.push({ expected: held, actual: typed });
238
- held++;
239
- typed++;
240
- }
241
- gap(expected.length, actual.length);
242
- return pairs;
243
- }
244
- /**
245
- * What a typed syllable is, against what was expected in its place.
246
- *
247
- * The neutral tone is the one tone pinyin writes with no mark at all, so a
248
- * syllable expected in it and typed without one has had its tone written
249
- * correctly rather than left off.
250
- */
251
- function verdictFor(expected, actual) {
252
- const tones = expected.accepted.get(actual.base);
253
- if (tones === undefined) {
254
- return "wrong";
255
- }
256
- if (actual.tone === undefined) {
257
- return tones.has(NEUTRAL_TONE) ? "correct" : "toneless";
258
- }
259
- return tones.has(actual.tone) ? "correct" : "tone";
260
- }
261
- /**
262
- * Where a typed syllable falls against the word boundaries.
263
- */
264
- function spacingFor(expected, actual) {
265
- if (actual.startsWord) {
266
- return expected.acceptsBreak ? "correct" : "split";
267
- }
268
- return expected.acceptsJoin ? "correct" : "joined";
269
- }
1
+ import { pairSyllables, spacingFor, verdictFor } from "./pair-syllables.js";
2
+ import { writeSyllableSpelling } from "../syllable/syllable.js";
3
+ import { expectedReading } from "./check-readings.js";
4
+ import { typedReading } from "./typed-reading.js";
270
5
  /**
271
6
  * Mark one pairing.
272
7
  *
@@ -315,7 +50,7 @@ function checkPair(expected, actual, required) {
315
50
  * and both parse, so `bei3jīng` is not a spelling mistake.
316
51
  * - **A reading the decoder itself was unsure of.** Where another reading of
317
52
  * the same character was there for the taking, it is accepted — see
318
- * {@link rejectedReadings}. 银行 is not one of those: the word settles both
53
+ * {@link import("./reading-tolerance.js").rejectedReadings}. 银行 is not one of those: the word settles both
319
54
  * syllables, so `yínxíng` really is wrong.
320
55
  * - **Sandhi either way.** 你好 is written `nǐ hǎo` and said `ní hǎo`, and 不是
321
56
  * is `bú shì` written and `bù shì` underneath. Both pass.
@@ -1 +1 @@
1
- {"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/grade/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAGL,aAAa,EACb,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,YAAY,EAEZ,qBAAq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AAC,CAAC,EAC1D,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAC9B,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACb,SAAS,CACP,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EACjE,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAC3D,EAAE,KAAK,EAAE,OAAO,EAAE,CACnB,CACF,CAAC;IACF,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IAEhE,OAAO;QACL,SAAS;QACT,SAAS,EAAE,OAAO,KAAK,SAAS,CAAC,MAAM;QACvC,KAAK,EAAE,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC,MAAM;QAC9D,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;KAC7C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Matching the expected syllables up with the typed ones.
3
+ *
4
+ * Aligned on the toneless spellings, so one dropped syllable is one mistake
5
+ * rather than a mistake on every syllable after it.
6
+ */
7
+ import type { PinyinVerdict, SpacingVerdict } from "./check.js";
8
+ import type { ExpectedSyllable } from "./check-readings.js";
9
+ import type { TypedSyllable } from "./typed-reading.js";
10
+ /**
11
+ * Which expected syllable a typed one was matched with, where either has one.
12
+ */
13
+ interface Pairing {
14
+ readonly expected: number | undefined;
15
+ readonly actual: number | undefined;
16
+ }
17
+ /**
18
+ * Match the expected syllables up with the typed ones.
19
+ *
20
+ * Aligned on the toneless spellings, for the reason
21
+ * {@link import("../accuracy/score.js").scoreCase} aligns on them: a syllable
22
+ * dropped or invented halfway through would otherwise knock everything after it
23
+ * out of step, and be reported as a mistake on every syllable rather than on
24
+ * the one.
25
+ *
26
+ * What the alignment leaves over is then paired off within each gap, which is
27
+ * what turns two unrelated stretches into substitutions: 银行 typed `yínxíng`
28
+ * anchors on `yín`, leaving one expected `háng` against one typed `xíng` — one
29
+ * wrong syllable rather than one missing and one invented.
30
+ */
31
+ export declare function pairSyllables(expected: readonly string[], actual: readonly string[]): readonly Pairing[];
32
+ /**
33
+ * What a typed syllable is, against what was expected in its place.
34
+ *
35
+ * The neutral tone is the one tone pinyin writes with no mark at all, so a
36
+ * syllable expected in it and typed without one has had its tone written
37
+ * correctly rather than left off.
38
+ */
39
+ export declare function verdictFor(expected: ExpectedSyllable, actual: TypedSyllable): PinyinVerdict;
40
+ /**
41
+ * Where a typed syllable falls against the word boundaries.
42
+ */
43
+ export declare function spacingFor(expected: ExpectedSyllable, actual: TypedSyllable): SpacingVerdict;
44
+ export {};
45
+ /**
46
+ * What is required of a check beyond reading the syllables right.
47
+ */
48
+ //# sourceMappingURL=pair-syllables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pair-syllables.d.ts","sourceRoot":"","sources":["../../src/grade/pair-syllables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,UAAU,OAAO;IACf,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,SAAS,OAAO,EAAE,CA2BpB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,aAAa,GACpB,aAAa,CASf;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,aAAa,GACpB,cAAc,CAKhB;;AAED;;GAEG"}
@@ -0,0 +1,71 @@
1
+ import { alignSequences } from "../accuracy/align.js";
2
+ import { NEUTRAL_TONE } from "../tone/tone.js";
3
+ /**
4
+ * Match the expected syllables up with the typed ones.
5
+ *
6
+ * Aligned on the toneless spellings, for the reason
7
+ * {@link import("../accuracy/score.js").scoreCase} aligns on them: a syllable
8
+ * dropped or invented halfway through would otherwise knock everything after it
9
+ * out of step, and be reported as a mistake on every syllable rather than on
10
+ * the one.
11
+ *
12
+ * What the alignment leaves over is then paired off within each gap, which is
13
+ * what turns two unrelated stretches into substitutions: 银行 typed `yínxíng`
14
+ * anchors on `yín`, leaving one expected `háng` against one typed `xíng` — one
15
+ * wrong syllable rather than one missing and one invented.
16
+ */
17
+ export function pairSyllables(expected, actual) {
18
+ const pairs = [];
19
+ let held = 0;
20
+ let typed = 0;
21
+ const gap = (untilExpected, untilActual) => {
22
+ while (held < untilExpected || typed < untilActual) {
23
+ const takesExpected = held < untilExpected;
24
+ const takesActual = typed < untilActual;
25
+ pairs.push({
26
+ expected: takesExpected ? held : undefined,
27
+ actual: takesActual ? typed : undefined,
28
+ });
29
+ held += takesExpected ? 1 : 0;
30
+ typed += takesActual ? 1 : 0;
31
+ }
32
+ };
33
+ for (const anchor of alignSequences(expected, actual)) {
34
+ gap(anchor.expected, anchor.actual);
35
+ pairs.push({ expected: held, actual: typed });
36
+ held++;
37
+ typed++;
38
+ }
39
+ gap(expected.length, actual.length);
40
+ return pairs;
41
+ }
42
+ /**
43
+ * What a typed syllable is, against what was expected in its place.
44
+ *
45
+ * The neutral tone is the one tone pinyin writes with no mark at all, so a
46
+ * syllable expected in it and typed without one has had its tone written
47
+ * correctly rather than left off.
48
+ */
49
+ export function verdictFor(expected, actual) {
50
+ const tones = expected.accepted.get(actual.base);
51
+ if (tones === undefined) {
52
+ return "wrong";
53
+ }
54
+ if (actual.tone === undefined) {
55
+ return tones.has(NEUTRAL_TONE) ? "correct" : "toneless";
56
+ }
57
+ return tones.has(actual.tone) ? "correct" : "tone";
58
+ }
59
+ /**
60
+ * Where a typed syllable falls against the word boundaries.
61
+ */
62
+ export function spacingFor(expected, actual) {
63
+ if (actual.startsWord) {
64
+ return expected.acceptsBreak ? "correct" : "split";
65
+ }
66
+ return expected.acceptsJoin ? "correct" : "joined";
67
+ }
68
+ /**
69
+ * What is required of a check beyond reading the syllables right.
70
+ */
71
+ //# sourceMappingURL=pair-syllables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pair-syllables.js","sourceRoot":"","sources":["../../src/grade/pair-syllables.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAY/C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAC3B,QAA2B,EAC3B,MAAyB;IAEzB,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,MAAM,GAAG,GAAG,CAAC,aAAqB,EAAE,WAAmB,EAAQ,EAAE;QAC/D,OAAO,IAAI,GAAG,aAAa,IAAI,KAAK,GAAG,WAAW,EAAE,CAAC;YACnD,MAAM,aAAa,GAAG,IAAI,GAAG,aAAa,CAAC;YAC3C,MAAM,WAAW,GAAG,KAAK,GAAG,WAAW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CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CACxB,QAA0B,EAC1B,MAAqB;IAErB,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,OAAO,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACrD,CAAC;IACD,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;AACrD,CAAC;AAED;;GAEG"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The syllables a conversion wrote, and what stands between them.
3
+ *
4
+ * The first half of reducing an answer to something comparable: a list of
5
+ * pieces becomes a list of syllables, each knowing where in the text it came
6
+ * from and whether a word began there. Nothing here weighs anything — that is
7
+ * `reading-tolerance.ts`, which decides what a learner may have written
8
+ * instead.
9
+ */
10
+ import type { ConvertedPiece } from "../decode/convert.js";
11
+ import type { Syllable } from "../syllable/syllable.js";
12
+ /**
13
+ * A piece of a conversion that writes a syllable.
14
+ */
15
+ export type ReadingPiece = ConvertedPiece & {
16
+ readonly syllable: Syllable;
17
+ };
18
+ /**
19
+ * What a conversion writes between one syllable and the one before it.
20
+ *
21
+ * `hyphen` is its own answer rather than a kind of break because it is one:
22
+ * 干干净净 is `gāngān-jìngjìng`, a single orthographic word with a boundary
23
+ * inside it, which is why {@link import("../syllable/split.js").splitSyllables}
24
+ * reads a hyphen as a syllable boundary and not a word one.
25
+ */
26
+ export type Junction = "join" | "hyphen" | "break";
27
+ /**
28
+ * One syllable of a conversion, with where it is and what precedes it.
29
+ */
30
+ export interface ReadingSyllable {
31
+ readonly piece: ReadingPiece;
32
+ readonly at: number;
33
+ readonly junction: Junction;
34
+ }
35
+ /**
36
+ * Where each piece's source characters start, in code points.
37
+ *
38
+ * Read off the sources rather than tracked through the conversion, which works
39
+ * because every character of the text is named by exactly one piece — a piece
40
+ * naming none is either pinyin orthography the source has no trace of, such as
41
+ * the space between two words, or a syllable reading on into the characters the
42
+ * piece before it named.
43
+ */
44
+ export declare function sourcePositions(pieces: readonly ConvertedPiece[]): readonly number[];
45
+ /**
46
+ * What a piece written between two syllables makes of the join.
47
+ *
48
+ * Only a hyphen written where the syllables would otherwise have run together
49
+ * is 分词连写's internal boundary; anything else — a space, punctuation, a
50
+ * stretch that was never Han — separates two words.
51
+ */
52
+ export declare function junctionOver(text: string, held: Junction): Junction;
53
+ /**
54
+ * The syllables a conversion writes, with their positions and what joins them.
55
+ *
56
+ * A conversion writes its syllables as adjacent pieces within a word — the
57
+ * 隔音符号 is part of a syllable's own spelling rather than a piece of its own —
58
+ * so anything standing between two of them is a boundary, and the hyphen of
59
+ * 分词连写 is the one that is not a word boundary.
60
+ */
61
+ export declare function readingSyllables(pieces: readonly ConvertedPiece[]): readonly ReadingSyllable[];
62
+ //# sourceMappingURL=reading-syllables.d.ts.map