@kensio/pinyinjs 1.7.5 → 1.7.7

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 (163) hide show
  1. package/README.md +128 -123
  2. package/data/full.entries +2637 -2637
  3. package/data/manifest.json +9 -9
  4. package/data/script.map +168 -3
  5. package/data/standard.entries +8 -8
  6. package/dist/decode/chang-complement.d.ts +19 -0
  7. package/dist/decode/chang-complement.d.ts.map +1 -0
  8. package/dist/decode/chang-complement.js +113 -0
  9. package/dist/decode/chang-complement.js.map +1 -0
  10. package/dist/decode/chang-context.d.ts +29 -0
  11. package/dist/decode/chang-context.d.ts.map +1 -0
  12. package/dist/decode/chang-context.js +99 -0
  13. package/dist/decode/chang-context.js.map +1 -0
  14. package/dist/decode/chang-rule.d.ts +47 -0
  15. package/dist/decode/chang-rule.d.ts.map +1 -0
  16. package/dist/decode/chang-rule.js +188 -0
  17. package/dist/decode/chang-rule.js.map +1 -0
  18. package/dist/decode/confidence.d.ts +11 -3
  19. package/dist/decode/confidence.d.ts.map +1 -1
  20. package/dist/decode/confidence.js +11 -3
  21. package/dist/decode/confidence.js.map +1 -1
  22. package/dist/decode/convert-pipeline.d.ts.map +1 -1
  23. package/dist/decode/convert-pipeline.js +5 -4
  24. package/dist/decode/convert-pipeline.js.map +1 -1
  25. package/dist/decode/de-rule.d.ts +74 -0
  26. package/dist/decode/de-rule.d.ts.map +1 -0
  27. package/dist/decode/de-rule.js +199 -0
  28. package/dist/decode/de-rule.js.map +1 -0
  29. package/dist/decode/decode.d.ts +12 -25
  30. package/dist/decode/decode.d.ts.map +1 -1
  31. package/dist/decode/decode.js +10 -47
  32. package/dist/decode/decode.js.map +1 -1
  33. package/dist/decode/decoders.d.ts +9 -4
  34. package/dist/decode/decoders.d.ts.map +1 -1
  35. package/dist/decode/decoders.js +7 -7
  36. package/dist/decode/decoders.js.map +1 -1
  37. package/dist/decode/edge-context.d.ts +19 -0
  38. package/dist/decode/edge-context.d.ts.map +1 -1
  39. package/dist/decode/edge-context.js +41 -0
  40. package/dist/decode/edge-context.js.map +1 -1
  41. package/dist/decode/hint-lattice.d.ts.map +1 -1
  42. package/dist/decode/hint-lattice.js +17 -3
  43. package/dist/decode/hint-lattice.js.map +1 -1
  44. package/dist/decode/jiao-rule.d.ts +9 -3
  45. package/dist/decode/jiao-rule.d.ts.map +1 -1
  46. package/dist/decode/jiao-rule.js +44 -5
  47. package/dist/decode/jiao-rule.js.map +1 -1
  48. package/dist/decode/lattice-decode.d.ts +28 -0
  49. package/dist/decode/lattice-decode.d.ts.map +1 -0
  50. package/dist/decode/lattice-decode.js +48 -0
  51. package/dist/decode/lattice-decode.js.map +1 -0
  52. package/dist/decode/lattice-slice.d.ts +22 -6
  53. package/dist/decode/lattice-slice.d.ts.map +1 -1
  54. package/dist/decode/lattice-slice.js +24 -18
  55. package/dist/decode/lattice-slice.js.map +1 -1
  56. package/dist/decode/lattice-types.d.ts +27 -8
  57. package/dist/decode/lattice-types.d.ts.map +1 -1
  58. package/dist/decode/lattice-types.js +27 -8
  59. package/dist/decode/lattice-types.js.map +1 -1
  60. package/dist/decode/numbers.d.ts +0 -8
  61. package/dist/decode/numbers.d.ts.map +1 -1
  62. package/dist/decode/numbers.js +0 -10
  63. package/dist/decode/numbers.js.map +1 -1
  64. package/dist/decode/polyphone-rules.d.ts +7 -27
  65. package/dist/decode/polyphone-rules.d.ts.map +1 -1
  66. package/dist/decode/polyphone-rules.js +7 -155
  67. package/dist/decode/polyphone-rules.js.map +1 -1
  68. package/dist/decode/reading-rules.d.ts +1 -29
  69. package/dist/decode/reading-rules.d.ts.map +1 -1
  70. package/dist/decode/reading-rules.js +5 -69
  71. package/dist/decode/reading-rules.js.map +1 -1
  72. package/dist/decode/rules.d.ts +1 -1
  73. package/dist/decode/rules.d.ts.map +1 -1
  74. package/dist/decode/rules.js +1 -1
  75. package/dist/decode/rules.js.map +1 -1
  76. package/dist/decode/run-context.d.ts +33 -0
  77. package/dist/decode/run-context.d.ts.map +1 -0
  78. package/dist/decode/run-context.js +47 -0
  79. package/dist/decode/run-context.js.map +1 -0
  80. package/dist/decode/run-lattice.d.ts +13 -10
  81. package/dist/decode/run-lattice.d.ts.map +1 -1
  82. package/dist/decode/run-lattice.js +15 -12
  83. package/dist/decode/run-lattice.js.map +1 -1
  84. package/dist/decode/run-words.d.ts +17 -0
  85. package/dist/decode/run-words.d.ts.map +1 -0
  86. package/dist/decode/run-words.js +29 -0
  87. package/dist/decode/run-words.js.map +1 -0
  88. package/dist/decode/sandhi-input.d.ts +30 -0
  89. package/dist/decode/sandhi-input.d.ts.map +1 -0
  90. package/dist/decode/sandhi-input.js +35 -0
  91. package/dist/decode/sandhi-input.js.map +1 -0
  92. package/dist/decode/sandhi-tones.d.ts +33 -5
  93. package/dist/decode/sandhi-tones.d.ts.map +1 -1
  94. package/dist/decode/sandhi-tones.js +59 -8
  95. package/dist/decode/sandhi-tones.js.map +1 -1
  96. package/dist/decode/sandhi.d.ts +9 -6
  97. package/dist/decode/sandhi.d.ts.map +1 -1
  98. package/dist/decode/sandhi.js +10 -7
  99. package/dist/decode/sandhi.js.map +1 -1
  100. package/dist/decode/script-region.d.ts +15 -0
  101. package/dist/decode/script-region.d.ts.map +1 -0
  102. package/dist/decode/script-region.js +61 -0
  103. package/dist/decode/script-region.js.map +1 -0
  104. package/dist/decode/script-types.d.ts +11 -2
  105. package/dist/decode/script-types.d.ts.map +1 -1
  106. package/dist/decode/script-types.js +2 -1
  107. package/dist/decode/script-types.js.map +1 -1
  108. package/dist/decode/script-words.d.ts +7 -5
  109. package/dist/decode/script-words.d.ts.map +1 -1
  110. package/dist/decode/script-words.js +18 -25
  111. package/dist/decode/script-words.js.map +1 -1
  112. package/dist/decode/script.d.ts.map +1 -1
  113. package/dist/decode/script.js +2 -1
  114. package/dist/decode/script.js.map +1 -1
  115. package/dist/decode/write-run.d.ts +0 -7
  116. package/dist/decode/write-run.d.ts.map +1 -1
  117. package/dist/decode/write-run.js +4 -39
  118. package/dist/decode/write-run.js.map +1 -1
  119. package/dist/dictionary/cedict-senses.d.ts +7 -0
  120. package/dist/dictionary/cedict-senses.d.ts.map +1 -1
  121. package/dist/dictionary/cedict-senses.js +12 -0
  122. package/dist/dictionary/cedict-senses.js.map +1 -1
  123. package/dist/dictionary/constituent-repair.d.ts +36 -0
  124. package/dist/dictionary/constituent-repair.d.ts.map +1 -0
  125. package/dist/dictionary/constituent-repair.js +117 -0
  126. package/dist/dictionary/constituent-repair.js.map +1 -0
  127. package/dist/dictionary/measure-tone.d.ts +36 -0
  128. package/dist/dictionary/measure-tone.d.ts.map +1 -0
  129. package/dist/dictionary/measure-tone.js +139 -0
  130. package/dist/dictionary/measure-tone.js.map +1 -0
  131. package/dist/dictionary/merge-types.d.ts +13 -2
  132. package/dist/dictionary/merge-types.d.ts.map +1 -1
  133. package/dist/dictionary/merge-types.js.map +1 -1
  134. package/dist/dictionary/merge-walk.d.ts +27 -0
  135. package/dist/dictionary/merge-walk.d.ts.map +1 -0
  136. package/dist/dictionary/merge-walk.js +49 -0
  137. package/dist/dictionary/merge-walk.js.map +1 -0
  138. package/dist/dictionary/merge.d.ts +3 -3
  139. package/dist/dictionary/merge.d.ts.map +1 -1
  140. package/dist/dictionary/merge.js +24 -28
  141. package/dist/dictionary/merge.js.map +1 -1
  142. package/dist/dictionary/overrides.d.ts +5 -0
  143. package/dist/dictionary/overrides.d.ts.map +1 -1
  144. package/dist/dictionary/overrides.js +5 -5
  145. package/dist/dictionary/overrides.js.map +1 -1
  146. package/dist/dictionary/script-tables.js +91 -13
  147. package/dist/dictionary/script-tables.js.map +1 -1
  148. package/dist/dictionary/word-readings.d.ts.map +1 -1
  149. package/dist/dictionary/word-readings.js +6 -0
  150. package/dist/dictionary/word-readings.js.map +1 -1
  151. package/dist/index.d.ts +1 -1
  152. package/dist/index.d.ts.map +1 -1
  153. package/dist/index.js +1 -1
  154. package/dist/index.js.map +1 -1
  155. package/dist/script/glyphs.d.ts +9 -8
  156. package/dist/script/glyphs.d.ts.map +1 -1
  157. package/dist/script/glyphs.js +21 -48
  158. package/dist/script/glyphs.js.map +1 -1
  159. package/dist/script/reading-splits.d.ts +41 -0
  160. package/dist/script/reading-splits.d.ts.map +1 -0
  161. package/dist/script/reading-splits.js +98 -0
  162. package/dist/script/reading-splits.js.map +1 -0
  163. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"script-words.js","sourceRoot":"","sources":["../../src/decode/script-words.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAEL,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,kBAAkB,EAElB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAI7B;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAoB;IAI3C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IACpD,CAAC;IACD,OAAO;QACL,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;KACxD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,KAA+C,EAC/C,KAAkC,EAClC,IAAY,EACZ,OAA4B;IAE5B,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,2EAA2E;IAC3E,4EAA4E;IAC5E,gEAAgE;IAChE,MAAM,kBAAkB,GACtB,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9D,MAAM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AE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,aAAkB,GAC1B,gBAAgB,CA0ClB;AAeD;;GAEG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAER;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAE/D"}
1
+ {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../src/decode/script.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAS5D,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,cAAc,EACd,KAAK,YAAY,GAClB,MAAM,mBAAmB,CAAC;AAC3B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,aAAkB,GAC1B,gBAAgB,CA0ClB;AAeD;;GAEG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAER;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAE/D"}
@@ -4,7 +4,8 @@ import { detectScript } from "../script/script.js";
4
4
  import { decodeRun } from "./decode.js";
5
5
  import { READING_RULES } from "./reading-rules.js";
6
6
  import { splitRuns } from "./runs.js";
7
- import { applyRegion, convertWord, targetOf } from "./script-words.js";
7
+ import { applyRegion } from "./script-region.js";
8
+ import { convertWord, targetOf } from "./script-words.js";
8
9
  export { SCRIPT_EVIDENCE, SCRIPT_TARGETS, } from "./script-types.js";
9
10
  /**
10
11
  * Convert a text between the scripts, reporting what it was unsure about.
@@ -1 +1 @@
1
- {"version":3,"file":"script.js","sourceRoot":"","sources":["../../src/decode/script.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAOvE,OAAO,EACL,eAAe,EAKf,cAAc,GAEf,MAAM,mBAAmB,CAAC;AAC3B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAC5B,UAAsB,EACtB,MAAoB,EACpB,IAAY,EACZ,OAAO,GAAkB,EAAE;IAE3B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,SAAS,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;IAC7E,MAAM,KAAK,GACT,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAEvE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Y,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;YACzE,MAAM,MAAM,GAAG,WAAW,CACxB,YAAY;gBACV,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;gBACrB,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,EACtD,IAAI,CAAC,OAAO,EACZ,MAAM,EACN,SAAS,CACV,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;YACxB,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAC5C,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,SAAS;QACb,QAAQ,EAAE,QAAiB;QAC3B,YAAY,EAAE,EAAE;KACjB,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CACtB,UAAsB,EACtB,MAAoB,EACpB,IAAY,EACZ,OAAO,GAAkB,EAAE;IAE3B,OAAO,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAoB;IACpD,OAAO,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC;AACvC,CAAC"}
@@ -18,11 +18,4 @@ export declare function writeRun(dictionary: Dictionary, words: readonly ScoredW
18
18
  * Rewrite every piece's text with a pass that reads across all of them.
19
19
  */
20
20
  export declare function rewrite(pieces: readonly ConvertedPiece[], pass: (parts: readonly string[]) => readonly string[]): readonly ConvertedPiece[];
21
- /**
22
- * The words a Han run decodes to, with 分词连写 applied.
23
- *
24
- * Grouping rewrites word boundaries and never the readings behind them, so the
25
- * syllables — and the confidence beside them — survive it in order.
26
- */
27
- export declare function wordsOf(decoded: readonly ScoredWord[], dictionary: Dictionary, isGrouped: boolean): readonly ScoredWord[];
28
21
  //# sourceMappingURL=write-run.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"write-run.d.ts","sourceRoot":"","sources":["../../src/decode/write-run.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAInB,KAAK,OAAO,EACb,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,aAAa,GAAG,SAAS,GAChC,SAAS,cAAc,EAAE,CA0C3B;AAED;;GAEG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,SAAS,cAAc,EAAE,EACjC,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,EAAE,GACpD,SAAS,cAAc,EAAE,CAO3B;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,OAAO,GACjB,SAAS,UAAU,EAAE,CAUvB"}
1
+ {"version":3,"file":"write-run.d.ts","sourceRoot":"","sources":["../../src/decode/write-run.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACL,KAAK,cAAc,EAInB,KAAK,OAAO,EACb,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,aAAa,GAAG,SAAS,GAChC,SAAS,cAAc,EAAE,CAqC3B;AAED;;GAEG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,SAAS,cAAc,EAAE,EACjC,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,EAAE,GACpD,SAAS,cAAc,EAAE,CAO3B"}
@@ -1,5 +1,4 @@
1
- import { applyGrouping } from "../orthography/grouping.js";
2
- import { divisionOf } from "./constituents.js";
1
+ import { charactersPerSyllable, groupingOf } from "./sandhi-input.js";
3
2
  import { applySandhi } from "./sandhi.js";
4
3
  import { plainPiece, readingFor, writeWord, } from "./pieces.js";
5
4
  /**
@@ -7,17 +6,10 @@ import { plainPiece, readingFor, writeWord, } from "./pieces.js";
7
6
  */
8
7
  export function writeRun(dictionary, words, locale, written, sandhi) {
9
8
  // Sandhi runs across the whole run rather than within a word, since 不 in one
10
- // word assimilates to the tone starting the next. Third-tone sandhi needs to
11
- // know where the words are all the same, so the grouping goes with it — and
12
- // only when it is asked for, since dividing a word costs lookups.
9
+ // word assimilates to the tone starting the next, and what it needs beyond
10
+ // the syllables is in `sandhi-input.ts`.
13
11
  const readings = words.map((scored) => readingFor(dictionary, scored.word, locale));
14
- const grouping = sandhi?.thirdTone === true
15
- ? words.map((scored, index) => {
16
- const reading = readings[index] ?? [];
17
- return (divisionOf(dictionary, scored.word.text, reading) ?? reading.length);
18
- })
19
- : undefined;
20
- const flattened = applySandhi(readings.flat(), sandhi, grouping);
12
+ const flattened = applySandhi(readings.flat(), sandhi, groupingOf(dictionary, words, readings, sandhi?.thirdTone === true), charactersPerSyllable(words, readings));
21
13
  let at = 0;
22
14
  const pieces = [];
23
15
  for (const [index, scored] of words.entries()) {
@@ -47,31 +39,4 @@ export function rewrite(pieces, pass) {
47
39
  return text === piece.text ? piece : { ...piece, text };
48
40
  });
49
41
  }
50
- /**
51
- * The words a Han run decodes to, with 分词连写 applied.
52
- *
53
- * Grouping rewrites word boundaries and never the readings behind them, so the
54
- * syllables — and the confidence beside them — survive it in order.
55
- */
56
- export function wordsOf(decoded, dictionary, isGrouped) {
57
- return isGrouped
58
- ? regroup(decoded, applyGrouping(decoded.map((scored) => scored.word), dictionary))
59
- : decoded;
60
- }
61
- /**
62
- * Redistribute the decode's per-syllable confidence over regrouped words.
63
- *
64
- * 分词连写 moves word boundaries — 看 and 了 become 看了 — without touching a
65
- * reading, so the run's syllables are the same syllables in the same order and
66
- * are simply cut in different places.
67
- */
68
- function regroup(decoded, grouped) {
69
- const confidence = decoded.flatMap((scored) => [...scored.confidence]);
70
- let at = 0;
71
- return grouped.map((word) => {
72
- const held = confidence.slice(at, at + word.reading.length);
73
- at += word.reading.length;
74
- return { word, confidence: held };
75
- });
76
- }
77
42
  //# sourceMappingURL=write-run.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"write-run.js","sourceRoot":"","sources":["../../src/decode/write-run.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAA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K,EAAE,EAAE,EAAE,EAAE;QAC9B,qEAAqE;QACrE,MAAM,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC;QACzC,OAAO,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -32,6 +32,13 @@ export declare function indexCedict(cedict: readonly CedictEntry[], formOf: (ent
32
32
  * A word's readings as CC-CEDICT gives them, one per sense.
33
33
  */
34
34
  export declare function cedictReadingsOf(word: string, entries: readonly CedictEntry[]): readonly (readonly Syllable[])[];
35
+ /**
36
+ * Ask either index for every reading CC-CEDICT gives a spelling.
37
+ *
38
+ * Both scripts, because a word can be listed under one and not the other, and
39
+ * an empty answer means CC-CEDICT does not hold the spelling at all.
40
+ */
41
+ export declare function senseLookup(byWord: ReadonlyMap<string, readonly CedictEntry[]>, byHant: ReadonlyMap<string, readonly CedictEntry[]>): (word: string) => readonly (readonly Syllable[])[];
35
42
  /**
36
43
  * Whether a proposed 國語 reading is really another 普通话 sense of the word.
37
44
  *
@@ -1 +1 @@
1
- {"version":3,"file":"cedict-senses.d.ts","sourceRoot":"","sources":["../../src/dictionary/cedict-senses.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,EACnD,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,GAClD,OAAO,CAOT;AAED;;GAEG;AACH,wBAAgB,WAAW,C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C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,WAAW,EAAE,GAC9B,SAAS,CAAC,SAAS,QAAQ,EAAE,CAAC,EAAE,CAIlC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,EACnD,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,GAClD,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC,SAAS,QAAQ,EAAE,CAAC,EAAE,CAKpD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,aAAa,EAAE,SAAS,CAAC,SAAS,QAAQ,EAAE,CAAC,EAAE,GAC9C,OAAO,CAET;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,GAAG,SAAS,GAC7B,OAAO,CAET"}
@@ -62,6 +62,18 @@ export function cedictReadingsOf(word, entries) {
62
62
  .map((entry) => readDictionaryReading(word, entry.readings))
63
63
  .filter((reading) => reading !== undefined);
64
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
+ }
65
77
  /**
66
78
  * Whether a proposed 國語 reading is really another 普通话 sense of the word.
67
79
  *
@@ -1 +1 @@
1
- {"version":3,"file":"cedict-senses.js","sourceRoot":"","sources":["../../src/dictionary/cedict-senses.ts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Aa,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,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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E,CAAC;aAC5B,CAAC;YACF,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,KAAK,CAAC;QACf,CAAC;QAED,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC;IACtE,CAAC,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;AACtE,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { type Tone } from "../tone/tone.js";
2
+ import type { DictionaryEntry } from "./entry.js";
3
+ /**
4
+ * The determiners that take 个 into a word of their own, where it is 轻声.
5
+ *
6
+ * Six characters and not a part of speech, because the tag cannot draw the
7
+ * line. jieba tags 这个, 那个 and 每个 `r` and tags 各个, 某个 and 整个 `r` as
8
+ * well, and those three are `gègè`, `mǒugè` and `zhěnggè` in both sources with
9
+ * nothing disagreeing. So this is a list of judgements, in the way
10
+ * {@link import("./neutral-senses.js").NEUTRAL_SENSE_WORDS} is, and the words
11
+ * it decides are the ones where a source writes the 轻声 on the determiner and
12
+ * the pair together.
13
+ */
14
+ export declare const NEUTRAL_MEASURE_DETERMINERS: ReadonlySet<string>;
15
+ /**
16
+ * The tone the 个 at a position takes, or undefined where nothing settles it.
17
+ */
18
+ export declare function countingToneAt(characters: readonly string[], at: number): Tone | undefined;
19
+ /**
20
+ * What the settling pass changed.
21
+ */
22
+ export interface MeasureToneSettlement {
23
+ readonly entries: readonly DictionaryEntry[];
24
+ /** Entries whose 个 was retoned. */
25
+ readonly settled: number;
26
+ }
27
+ /**
28
+ * Give every 个 the tone its position calls for.
29
+ *
30
+ * Runs over the finished entries, before the constituent repair, so that a
31
+ * phrase held to the words inside it is held to a settled reading. Only the
32
+ * 普通话 reading is touched. A zh-TW delta is a claim about how 國語 differs
33
+ * from what stands beside it, and none of the 279 entries holding a 个 has one.
34
+ */
35
+ export declare function settleMeasureTones(entries: readonly DictionaryEntry[]): MeasureToneSettlement;
36
+ //# sourceMappingURL=measure-tone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure-tone.d.ts","sourceRoot":"","sources":["../../src/dictionary/measure-tone.ts"],"names":[],"mappings":"AA6CA,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAYlD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAQ1D,CAAC;AAgBH;;GAEG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,EAAE,EAAE,MAAM,GACT,IAAI,GAAG,SAAS,CAQlB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,eAAe,EAAE,GAClC,qBAAqB,CAsCvB"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Settling the tone of 个, which no source settles for itself.
3
+ *
4
+ * Every source writes 个 both ways, and where one writes the 轻声 it is a
5
+ * choice made an entry at a time. CC-CEDICT has 一个 `ge5` beside 一个人 `ge4`,
6
+ * 那个 `ge5` beside 那个人 `ge4`, 上个 `ge5` beside 上个月 `ge4`, and 每个 `ge4`
7
+ * beside 每个人 `ge5`. large_pinyin wanders the same way over 半个 and 半个人,
8
+ * and over 这个 and 这些个. No reading of sense separates them, because there is
9
+ * no difference of sense to read: 那个人 is 那个 followed by 人.
10
+ *
11
+ * The sources do agree on the proportion. The full tone is the large majority in
12
+ * all three. 现代汉语频率词典 counts 个 as `gè` 11,693 times against `ge` 1,891
13
+ * (Unihan's `kHanyuPinlu`), large_pinyin writes 243 against 36, and CC-CEDICT
14
+ * 102 against 45. So the package writes the tone and names the exception.
15
+ *
16
+ * **A numeral in front of it means the 量词 is counting**, and a counting 个 is
17
+ * written `gè`: 一个, 两个, 十二个, 一百个, and 一个人 and 上一个 with them.
18
+ * This is what the gold corpus already asserts for every 个 it holds, and what
19
+ * the 一个 override used to state on its own.
20
+ *
21
+ * **The exception is the determiners.** 这个, 那个 and 哪个 are headwords in
22
+ * 现代汉语词典 read `zhège`, `nàge` and `nǎge`, and both sources write them 轻声
23
+ * wherever the pair stands on its own. 每个, 上个 and 下个 are the same
24
+ * determiner shape and the sources split on them by length: CC-CEDICT has 上个
25
+ * `ge5` beside 上个月 `ge4`, and 每个 `ge4` beside 每个人 `ge5`. The 轻声 is taken
26
+ * for all six, which is what 那个人, 每个人 and 上个月 are said with.
27
+ *
28
+ * Everything else keeps the reading its source gave it. 几个, 半个, 多个 and
29
+ * 单个 have neither a numeral nor a listed determiner in front of them, so their
30
+ * 轻声 stands. So does the colloquial 个 of 我勒个去 and 一口吃个胖子, which
31
+ * counts nothing, and the 北京话 今儿个, 明儿个 and 昨儿个, whose 儿 folds into
32
+ * the syllable before it and leaves the reading shorter than the key.
33
+ *
34
+ * Measured over the committed dictionary it retones 25 entries of the 279 that
35
+ * hold a 个. Over the 88,866 lines of Tatoeba and zh.wikipedia the reading
36
+ * rules were sized against it moves 339 conversions, and every one is a 个:
37
+ * 每个 106, 那个 63, 下个月 and 下个星期 62, 上个月 and 上个星期 60, and 35
38
+ * where 一个 gains its tone and the 一 sandhi that follows from it. Before the
39
+ * pass, 2,467 of the corpus's 5,397 个 sat after a character the package read
40
+ * both ways; after it, 204 do, and all of those are positions no key covers,
41
+ * where the decode falls back to the character's own `gè`.
42
+ */
43
+ import { QUANTITY_CHARACTERS } from "../numerals/characters.js";
44
+ import { toCharacters } from "../script/characters.js";
45
+ import { NEUTRAL_TONE } from "../tone/tone.js";
46
+ /**
47
+ * The 量词 this settles, in both scripts.
48
+ */
49
+ const MEASURE_CHARACTERS = new Set(["个", "個"]);
50
+ /**
51
+ * The tone a counting 个 carries.
52
+ */
53
+ const COUNTING_TONE = 4;
54
+ /**
55
+ * The determiners that take 个 into a word of their own, where it is 轻声.
56
+ *
57
+ * Six characters and not a part of speech, because the tag cannot draw the
58
+ * line. jieba tags 这个, 那个 and 每个 `r` and tags 各个, 某个 and 整个 `r` as
59
+ * well, and those three are `gègè`, `mǒugè` and `zhěnggè` in both sources with
60
+ * nothing disagreeing. So this is a list of judgements, in the way
61
+ * {@link import("./neutral-senses.js").NEUTRAL_SENSE_WORDS} is, and the words
62
+ * it decides are the ones where a source writes the 轻声 on the determiner and
63
+ * the pair together.
64
+ */
65
+ export const NEUTRAL_MEASURE_DETERMINERS = new Set([
66
+ "这",
67
+ "這",
68
+ "那",
69
+ "哪",
70
+ "每",
71
+ "上",
72
+ "下",
73
+ ]);
74
+ /**
75
+ * Whether a syllable is the 量词 rather than 个's other reading.
76
+ *
77
+ * 独自个 is `dú zì gě`, and a `gě` retoned to `gè` would be a different word.
78
+ * Testing the syllable keeps it out without a list of the words it appears in.
79
+ */
80
+ function isCountingSyllable(syllable) {
81
+ return (syllable.initial === "g" &&
82
+ syllable.final === "e" &&
83
+ (syllable.tone === COUNTING_TONE || syllable.tone === NEUTRAL_TONE));
84
+ }
85
+ /**
86
+ * The tone the 个 at a position takes, or undefined where nothing settles it.
87
+ */
88
+ export function countingToneAt(characters, at) {
89
+ // Nothing stands in front of a 个 that starts the word, and nothing settles
90
+ // it there: 个人 is `gèrén` on its own account.
91
+ const before = characters[at - 1] ?? "";
92
+ if (NEUTRAL_MEASURE_DETERMINERS.has(before)) {
93
+ return NEUTRAL_TONE;
94
+ }
95
+ return QUANTITY_CHARACTERS.has(before) ? COUNTING_TONE : undefined;
96
+ }
97
+ /**
98
+ * Give every 个 the tone its position calls for.
99
+ *
100
+ * Runs over the finished entries, before the constituent repair, so that a
101
+ * phrase held to the words inside it is held to a settled reading. Only the
102
+ * 普通话 reading is touched. A zh-TW delta is a claim about how 國語 differs
103
+ * from what stands beside it, and none of the 279 entries holding a 个 has one.
104
+ */
105
+ export function settleMeasureTones(entries) {
106
+ let settled = 0;
107
+ const settle = (entry) => {
108
+ const characters = toCharacters(entry.hans);
109
+ const reading = entry.readings.cn;
110
+ // 儿化 folds two characters into one syllable, so a reading shorter than
111
+ // the word says nothing about which character each syllable reads.
112
+ if (reading.length !== characters.length) {
113
+ return entry;
114
+ }
115
+ const corrected = [...reading];
116
+ let isMoved = false;
117
+ for (const [at, syllable] of reading.entries()) {
118
+ if (
119
+ /* c8 ignore next -- the reading and the characters are the same length */
120
+ !MEASURE_CHARACTERS.has(characters[at] ?? "") ||
121
+ !isCountingSyllable(syllable)) {
122
+ continue;
123
+ }
124
+ const tone = countingToneAt(characters, at);
125
+ if (tone === undefined || syllable.tone === tone) {
126
+ continue;
127
+ }
128
+ corrected[at] = { ...syllable, tone };
129
+ isMoved = true;
130
+ }
131
+ if (!isMoved) {
132
+ return entry;
133
+ }
134
+ settled++;
135
+ return { ...entry, readings: { ...entry.readings, cn: corrected } };
136
+ };
137
+ return { entries: entries.map((entry) => settle(entry)), settled };
138
+ }
139
+ //# sourceMappingURL=measure-tone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure-tone.js","sourceRoot":"","sources":["../../src/dictionary/measure-tone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAa,MAAM,iBAAiB,CAAC;AAG1D;;GAEG;AACH,MAAM,kBAAk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E;QACnE,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC;YACzC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,SAAS,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;QAC/B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;YAC/C;YACE,0EAA0E;YAC1E,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;gBAC7C,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAC7B,CAAC;gBACD,SAAS;YACX,CAAC;YACD,MAAM,IAAI,GAAG,cAAc,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAC5C,IAAI,IAAI,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBACjD,SAAS;YACX,CAAC;YACD,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,CAAC;YACtC,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC;IACtE,CAAC,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;AACrE,CAAC"}
@@ -36,12 +36,22 @@ export interface MergeStats {
36
36
  readonly reducedNeutrals: number;
37
37
  /** Words whose trailing 儿 was folded into the syllable before it. */
38
38
  readonly erhuaRepairs: number;
39
+ /**
40
+ * Entries whose 个 was retoned by its position — see
41
+ * {@link import("./measure-tone.js").settleMeasureTones}.
42
+ */
43
+ readonly settledMeasureTones: number;
39
44
  /** Words whose 繁體 form was derived rather than taken from CC-CEDICT. */
40
45
  readonly derivedTraditional: number;
41
46
  /** Entries with a 繁體 form differing from their 简体 one. */
42
47
  readonly scriptPairs: number;
43
48
  /** Entries a source writes more than one 繁體 spelling of. */
44
49
  readonly variantSpellings: number;
50
+ /**
51
+ * Phrase entries read as a corroborated word inside them reads them — see
52
+ * {@link import("./constituent-repair.js").repairConstituentReadings}.
53
+ */
54
+ readonly repairedConstituents: number;
45
55
  /** Entries carrying a zh-TW reading delta a source stated. */
46
56
  readonly taiwanReadings: number;
47
57
  /** Compounds given a zh-TW delta composed from their constituents. */
@@ -85,8 +95,9 @@ export interface WordSources {
85
95
  * What one word contributed to the build's counts.
86
96
  *
87
97
  * The per-word view of {@link MergeStats}, minus the counts no single word can
88
- * move: `reducedNeutrals` and `composedTaiwanReadings` are settled by passes
89
- * over the whole dictionary, and `rejected` is counted by the caller.
98
+ * move: `reducedNeutrals`, `settledMeasureTones`, `repairedConstituents` and
99
+ * `composedTaiwanReadings` are settled by passes over the whole dictionary, and
100
+ * `rejected` is counted by the caller.
90
101
  */
91
102
  export interface WordTally {
92
103
  readonly neutralToneCorrections: number;
@@ -1 +1 @@
1
- {"version":3,"file":"merge-types.d.ts","sourceRoot":"","sources":["../../src/dictionary/merge-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,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