@kensio/pinyinjs 1.7.6 → 1.7.8

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 (127) hide show
  1. package/README.md +2 -2
  2. package/data/full.counts +0 -0
  3. package/data/full.entries +46 -46
  4. package/data/manifest.json +15 -8
  5. package/data/script.map +102 -0
  6. package/data/standard.entries +8 -8
  7. package/dist/decode/chang-complement.d.ts +19 -0
  8. package/dist/decode/chang-complement.d.ts.map +1 -0
  9. package/dist/decode/chang-complement.js +113 -0
  10. package/dist/decode/chang-complement.js.map +1 -0
  11. package/dist/decode/chang-context.d.ts +9 -7
  12. package/dist/decode/chang-context.d.ts.map +1 -1
  13. package/dist/decode/chang-context.js +36 -3
  14. package/dist/decode/chang-context.js.map +1 -1
  15. package/dist/decode/chang-rule.d.ts +25 -15
  16. package/dist/decode/chang-rule.d.ts.map +1 -1
  17. package/dist/decode/chang-rule.js +38 -19
  18. package/dist/decode/chang-rule.js.map +1 -1
  19. package/dist/decode/convert-pipeline.d.ts.map +1 -1
  20. package/dist/decode/convert-pipeline.js +3 -3
  21. package/dist/decode/convert-pipeline.js.map +1 -1
  22. package/dist/decode/de-rule.d.ts +20 -0
  23. package/dist/decode/de-rule.d.ts.map +1 -1
  24. package/dist/decode/de-rule.js +87 -1
  25. package/dist/decode/de-rule.js.map +1 -1
  26. package/dist/decode/decode.d.ts +12 -25
  27. package/dist/decode/decode.d.ts.map +1 -1
  28. package/dist/decode/decode.js +10 -47
  29. package/dist/decode/decode.js.map +1 -1
  30. package/dist/decode/decoders.d.ts +9 -4
  31. package/dist/decode/decoders.d.ts.map +1 -1
  32. package/dist/decode/decoders.js +7 -7
  33. package/dist/decode/decoders.js.map +1 -1
  34. package/dist/decode/edge-context.d.ts +19 -0
  35. package/dist/decode/edge-context.d.ts.map +1 -1
  36. package/dist/decode/edge-context.js +41 -0
  37. package/dist/decode/edge-context.js.map +1 -1
  38. package/dist/decode/lattice-decode.d.ts +28 -0
  39. package/dist/decode/lattice-decode.d.ts.map +1 -0
  40. package/dist/decode/lattice-decode.js +48 -0
  41. package/dist/decode/lattice-decode.js.map +1 -0
  42. package/dist/decode/lattice-slice.d.ts +22 -6
  43. package/dist/decode/lattice-slice.d.ts.map +1 -1
  44. package/dist/decode/lattice-slice.js +24 -18
  45. package/dist/decode/lattice-slice.js.map +1 -1
  46. package/dist/decode/numbers.d.ts +0 -8
  47. package/dist/decode/numbers.d.ts.map +1 -1
  48. package/dist/decode/numbers.js +0 -10
  49. package/dist/decode/numbers.js.map +1 -1
  50. package/dist/decode/reading-rules.d.ts +1 -1
  51. package/dist/decode/reading-rules.d.ts.map +1 -1
  52. package/dist/decode/reading-rules.js +3 -2
  53. package/dist/decode/reading-rules.js.map +1 -1
  54. package/dist/decode/rules.d.ts +1 -1
  55. package/dist/decode/rules.d.ts.map +1 -1
  56. package/dist/decode/rules.js +1 -1
  57. package/dist/decode/rules.js.map +1 -1
  58. package/dist/decode/run-context.d.ts +33 -0
  59. package/dist/decode/run-context.d.ts.map +1 -0
  60. package/dist/decode/run-context.js +47 -0
  61. package/dist/decode/run-context.js.map +1 -0
  62. package/dist/decode/run-lattice.d.ts +13 -10
  63. package/dist/decode/run-lattice.d.ts.map +1 -1
  64. package/dist/decode/run-lattice.js +15 -12
  65. package/dist/decode/run-lattice.js.map +1 -1
  66. package/dist/decode/script-region.d.ts +15 -0
  67. package/dist/decode/script-region.d.ts.map +1 -0
  68. package/dist/decode/script-region.js +61 -0
  69. package/dist/decode/script-region.js.map +1 -0
  70. package/dist/decode/script-types.d.ts +11 -2
  71. package/dist/decode/script-types.d.ts.map +1 -1
  72. package/dist/decode/script-types.js +2 -1
  73. package/dist/decode/script-types.js.map +1 -1
  74. package/dist/decode/script-words.d.ts +7 -5
  75. package/dist/decode/script-words.d.ts.map +1 -1
  76. package/dist/decode/script-words.js +18 -25
  77. package/dist/decode/script-words.js.map +1 -1
  78. package/dist/decode/script.d.ts.map +1 -1
  79. package/dist/decode/script.js +2 -1
  80. package/dist/decode/script.js.map +1 -1
  81. package/dist/dictionary/artifact-claims.d.ts +8 -0
  82. package/dist/dictionary/artifact-claims.d.ts.map +1 -1
  83. package/dist/dictionary/artifact-claims.js +11 -1
  84. package/dist/dictionary/artifact-claims.js.map +1 -1
  85. package/dist/dictionary/artifact.d.ts.map +1 -1
  86. package/dist/dictionary/artifact.js +3 -5
  87. package/dist/dictionary/artifact.js.map +1 -1
  88. package/dist/dictionary/measure-tone.d.ts +36 -0
  89. package/dist/dictionary/measure-tone.d.ts.map +1 -0
  90. package/dist/dictionary/measure-tone.js +139 -0
  91. package/dist/dictionary/measure-tone.js.map +1 -0
  92. package/dist/dictionary/merge-types.d.ts +8 -3
  93. package/dist/dictionary/merge-types.d.ts.map +1 -1
  94. package/dist/dictionary/merge-types.js.map +1 -1
  95. package/dist/dictionary/merge.d.ts.map +1 -1
  96. package/dist/dictionary/merge.js +7 -1
  97. package/dist/dictionary/merge.js.map +1 -1
  98. package/dist/dictionary/overrides.d.ts +5 -0
  99. package/dist/dictionary/overrides.d.ts.map +1 -1
  100. package/dist/dictionary/overrides.js +5 -5
  101. package/dist/dictionary/overrides.js.map +1 -1
  102. package/dist/dictionary/script-tables.js +91 -13
  103. package/dist/dictionary/script-tables.js.map +1 -1
  104. package/dist/dictionary/source.d.ts +22 -0
  105. package/dist/dictionary/source.d.ts.map +1 -1
  106. package/dist/dictionary/source.js +24 -0
  107. package/dist/dictionary/source.js.map +1 -1
  108. package/dist/dictionary/word-counts.d.ts +74 -0
  109. package/dist/dictionary/word-counts.d.ts.map +1 -0
  110. package/dist/dictionary/word-counts.js +142 -0
  111. package/dist/dictionary/word-counts.js.map +1 -0
  112. package/dist/dictionary/word-readings.d.ts.map +1 -1
  113. package/dist/dictionary/word-readings.js +3 -0
  114. package/dist/dictionary/word-readings.js.map +1 -1
  115. package/dist/index.d.ts +3 -2
  116. package/dist/index.d.ts.map +1 -1
  117. package/dist/index.js +3 -2
  118. package/dist/index.js.map +1 -1
  119. package/dist/script/glyphs.d.ts +9 -8
  120. package/dist/script/glyphs.d.ts.map +1 -1
  121. package/dist/script/glyphs.js +21 -48
  122. package/dist/script/glyphs.js.map +1 -1
  123. package/dist/script/reading-splits.d.ts +41 -0
  124. package/dist/script/reading-splits.d.ts.map +1 -0
  125. package/dist/script/reading-splits.js +98 -0
  126. package/dist/script/reading-splits.js.map +1 -0
  127. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/decode/decode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAGjB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEzD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,iBAAiB,GAC5B,SAAS,WAAW,EAAE,CAmBxB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAIjE;AAGD,wBAAgB,SAAS,CACvB,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,SAAS,QAAQ,EAAkB,EAC1C,MAAM,SAAK,EACX,KAAK,CAAC,EAAE,aAAa,GACpB,SAAS,WAAW,EAAE,CAOxB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,SAAS,QAAQ,EAAkB,EAC1C,MAAM,SAAK,EACX,KAAK,CAAC,EAAE,aAAa,GACpB,SAAS,UAAU,EAAE,CAcvB"}
1
+ {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/decode/decode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpE,wBAAgB,SAAS,CACvB,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,SAAS,QAAQ,EAAkB,EAC1C,MAAM,SAAK,EACX,KAAK,CAAC,EAAE,aAAa,EACrB,KAAK,SAAK,GACT,SAAS,WAAW,EAAE,CAOxB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,SAAS,QAAQ,EAAkB,EAC1C,MAAM,SAAK,EACX,KAAK,CAAC,EAAE,aAAa,EACrB,KAAK,SAAK,GACT,SAAS,UAAU,EAAE,CAcvB"}
@@ -1,48 +1,11 @@
1
1
  import { scoreReadings } from "./confidence.js";
2
- import { cutPoints } from "./lattice.js";
3
- import { isSettled, projectReadings, settledUnits, unitsOf, } from "./locking.js";
2
+ import { decodeReadings } from "./lattice-decode.js";
3
+ import { projectReadings } from "./locking.js";
4
4
  import { READING_RULES } from "./reading-rules.js";
5
- import { readingCost, shortestPath, spacingCost } from "./viterbi.js";
6
- /**
7
- * Decode the run's readings, scoring only where the readings are still open.
8
- *
9
- * The asymmetry ALGORITHM.md calls for. A stretch between two cut points whose
10
- * positions all locked reads the same way on every path, so its readings are
11
- * read off the locks and no shortest path is run over it at all. Only the
12
- * stretches with a genuine choice in them are decoded.
13
- */
14
- export function decodeReadings(lattice, projection) {
15
- const cuts = cutPoints(lattice);
16
- const units = [];
17
- for (const [index, from] of cuts.entries()) {
18
- const to = cuts[index + 1];
19
- if (to === undefined) {
20
- break;
21
- }
22
- if (isSettled(projection, from, to)) {
23
- units.push(...settledUnits(projection, from, to));
24
- continue;
25
- }
26
- for (const edge of shortestPath(lattice, from, to, readingCost)) {
27
- units.push(...unitsOf(edge));
28
- }
29
- }
30
- return units;
31
- }
32
- /**
33
- * Where a decode would put the word boundaries, as character positions.
34
- *
35
- * Run over the whole lattice rather than the open stretches, because spacing
36
- * stays ambiguous where readings do not: 研究生命起源 reads identically whether
37
- * it splits 研究生/命 or 研究/生命, so every position in it locks, and the
38
- * spacing question is still open.
39
- */
40
- export function decodeSpacing(lattice) {
41
- return shortestPath(lattice, 0, lattice.characters.length, spacingCost).map((edge) => edge.from);
42
- }
5
+ export { decodeReadings, decodeSpacing } from "./lattice-decode.js";
43
6
  import { runGroups, runLattice, wordFrom } from "./run-lattice.js";
44
- export function decodeRun(dictionary, run, rules = READING_RULES, before = "", hints) {
45
- const held = runLattice(dictionary, run, rules, before, hints);
7
+ export function decodeRun(dictionary, run, rules = READING_RULES, before = "", hints, after = "") {
8
+ const held = runLattice(dictionary, run, rules, { before, after }, hints);
46
9
  const { lattice } = held;
47
10
  const units = decodeReadings(lattice, projectReadings(lattice));
48
11
  return runGroups(held, units).map((group) => wordFrom(dictionary, lattice, group));
@@ -55,12 +18,12 @@ export function decodeRun(dictionary, run, rules = READING_RULES, before = "", h
55
18
  * only worth running for a caller that will use the answer — rendering
56
19
  * uncertain readings differently, or reporting them.
57
20
  *
58
- * `before` is the context {@link decodeRun} takes, and means the same here: it
59
- * is decoded with the run and reported with neither words nor confidence of its
60
- * own.
21
+ * `before` and `after` are the context {@link decodeRun} takes, and mean the
22
+ * same here: they are decoded with the run and reported with neither words nor
23
+ * confidence of their own.
61
24
  */
62
- export function decodeRunScored(dictionary, run, rules = READING_RULES, before = "", hints) {
63
- const held = runLattice(dictionary, run, rules, before, hints);
25
+ export function decodeRunScored(dictionary, run, rules = READING_RULES, before = "", hints, after = "") {
26
+ const held = runLattice(dictionary, run, rules, { before, after }, hints);
64
27
  const { lattice } = held;
65
28
  const units = scoreReadings(lattice, projectReadings(lattice));
66
29
  return runGroups(held, units).map((group) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"decode.js","sourceRoot":"","sources":["../../src/decode/decode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAmB,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAgB,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,SAAS,EACT,eAAe,EAGf,YAAY,EACZ,OAAO,GACR,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGtE;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgB,EAChB,UAA6B;IAE7B,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,KAAK,GAAkB,EAAE,CAAC;IAEhC,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC3B,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACrB,MAAM;QACR,CAAC;QACD,IAAI,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,UAAU,EAAE,IAAI,EAA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SAChC,CAAC,CAAC,CACJ;KACF,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -7,12 +7,17 @@
7
7
  */
8
8
  import type { Dictionary } from "../dictionary/dictionary.js";
9
9
  import type { ResolvedHints } from "./hints.js";
10
+ import type { DecodeContext } from "./lattice-slice.js";
10
11
  import type { ScoredWord } from "./word.js";
11
12
  /**
12
13
  * How a Han run is turned into words, with whatever the decoder can say about
13
14
  * how settled they were.
15
+ *
16
+ * The context is one argument here where the exported decoders keep `before`
17
+ * and `after` apart, since nothing outside this package calls it and the two
18
+ * are one claim about the text around the run.
14
19
  */
15
- export type Decode = (dictionary: Dictionary, run: string, before: string, hints: ResolvedHints | undefined) => readonly ScoredWord[];
20
+ export type Decode = (dictionary: Dictionary, run: string, context: DecodeContext, hints: ResolvedHints | undefined) => readonly ScoredWord[];
16
21
  /**
17
22
  * The lattice decoder, reporting nothing about its own confidence.
18
23
  */
@@ -24,9 +29,9 @@ export declare const SCORED: Decode;
24
29
  /**
25
30
  * The greedy baseline, which has nothing to report either way.
26
31
  *
27
- * The context in front of a run goes unused: longest-match has no way to weigh
28
- * one segmentation against another, which is the whole reason it is the
29
- * baseline, and a 汉字 it cannot report would only be another thing to trim.
32
+ * The context around a run goes unused: longest-match has no way to weigh one
33
+ * segmentation against another, which is the whole reason it is the baseline,
34
+ * and 汉字 it cannot report would only be another thing to trim.
30
35
  */
31
36
  export declare const GREEDY: Decode;
32
37
  //# sourceMappingURL=decoders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decoders.d.ts","sourceRoot":"","sources":["../../src/decode/decoders.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,WAAW,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CACnB,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,aAAa,GAAG,SAAS,KAC7B,SAAS,UAAU,EAAE,CAAC;AAoB3B;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAErB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,MAC2C,CAAC;AAEjE;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,EAAE,MAAiC,CAAC"}
1
+ {"version":3,"file":"decoders.d.ts","sourceRoot":"","sources":["../../src/decode/decoders.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,WAAW,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,MAAM,MAAM,GAAG,CACnB,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,aAAa,GAAG,SAAS,KAC7B,SAAS,UAAU,EAAE,CAAC;AAoB3B;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MASrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,MAQlB,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,EAAE,MAEpB,CAAC"}
@@ -5,7 +5,7 @@ import { READING_RULES } from "./reading-rules.js";
5
5
  * A decoder that reports no confidence at all, which is every decoder but one.
6
6
  */
7
7
  function unscored(decode) {
8
- return (dictionary, run, before, hints) => decode(dictionary, run, before, hints).map((word) => ({
8
+ return (dictionary, run, context, hints) => decode(dictionary, run, context, hints).map((word) => ({
9
9
  word,
10
10
  confidence: [],
11
11
  }));
@@ -13,17 +13,17 @@ function unscored(decode) {
13
13
  /**
14
14
  * The lattice decoder, reporting nothing about its own confidence.
15
15
  */
16
- export const LATTICE = unscored((dictionary, run, before, hints) => decodeRun(dictionary, run, READING_RULES, before, hints));
16
+ export const LATTICE = unscored((dictionary, run, context, hints) => decodeRun(dictionary, run, READING_RULES, context.before, hints, context.after));
17
17
  /**
18
18
  * The lattice decoder, with what each reading was chosen over.
19
19
  */
20
- export const SCORED = (dictionary, run, before, hints) => decodeRunScored(dictionary, run, READING_RULES, before, hints);
20
+ export const SCORED = (dictionary, run, context, hints) => decodeRunScored(dictionary, run, READING_RULES, context.before, hints, context.after);
21
21
  /**
22
22
  * The greedy baseline, which has nothing to report either way.
23
23
  *
24
- * The context in front of a run goes unused: longest-match has no way to weigh
25
- * one segmentation against another, which is the whole reason it is the
26
- * baseline, and a 汉字 it cannot report would only be another thing to trim.
24
+ * The context around a run goes unused: longest-match has no way to weigh one
25
+ * segmentation against another, which is the whole reason it is the baseline,
26
+ * and 汉字 it cannot report would only be another thing to trim.
27
27
  */
28
- export const GREEDY = unscored(decodeGreedily);
28
+ export const GREEDY = unscored((dictionary, run) => decodeGreedily(dictionary, run));
29
29
  //# sourceMappingURL=decoders.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decoders.js","sourceRoot":"","sources":["../../src/decode/decoders.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAcnD;;GAEG;AACH,SAAS,QAAQ,CACf,MAK2B;IAE3B,OAAO,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CACxC,MAAM,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE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AE,CAC1E,SAAS,CACP,UAAU,EACV,GAAG,EACH,aAAa,EACb,OAAO,CAAC,MAAM,EACd,KAAK,EACL,OAAO,CAAC,KAAK,CACd,CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAW,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAChE,eAAe,CACb,UAAU,EACV,GAAG,EACH,aAAa,EACb,OAAO,CAAC,MAAM,EACd,KAAK,EACL,OAAO,CAAC,KAAK,CACd,CAAC;AAEJ;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAW,QAAQ,CAAC,CAAC,UAAU,EAAE,GAAG,EAAE,EAAE,CACzD,cAAc,CAAC,UAAU,EAAE,GAAG,CAAC,CAChC,CAAC"}
@@ -14,10 +14,29 @@ import type { EdgeContext } from "./rules.js";
14
14
  * usually choose, since the reading charge prefers fewer words.
15
15
  */
16
16
  export declare function wordEndingAt(context: EdgeContext, at: number, longest?: number): string | undefined;
17
+ /**
18
+ * Every word the dictionary has ending at a position, longest first.
19
+ *
20
+ * {@link wordEndingAt} answers with the longest, which is what a rule asking
21
+ * "what word is this" wants. A rule asking whether a *particular* word stands
22
+ * here wants all of them, because the longest match is often a word the rule
23
+ * has no opinion about wrapped around the one it does: 很 is a degree adverb
24
+ * and 得很 is the longest word ending at the same position, so 留得很长 hid its
25
+ * 很 and read `zhǎng`. 一个 hides 个 the same way.
26
+ */
27
+ export declare function wordsEndingAt(context: EdgeContext, at: number, longest?: number): readonly string[];
17
28
  /**
18
29
  * The word starting at a position, longest first, or undefined.
19
30
  */
20
31
  export declare function wordStartingAt(context: EdgeContext, at: number, longest?: number): string | undefined;
32
+ /**
33
+ * Every word the dictionary has starting at a position, longest first.
34
+ *
35
+ * The mirror of {@link wordsEndingAt}, and needed for the same reason: 五公 is a
36
+ * word and hides the 五 inside it, so a rule asking whether a numeral starts
37
+ * here has to be shown all of them.
38
+ */
39
+ export declare function wordsStartingAt(context: EdgeContext, at: number, longest?: number): readonly string[];
21
40
  /**
22
41
  * The part of speech the dictionary gives a word, or the empty string.
23
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"edge-context.d.ts","sourceRoot":"","sources":["../../src/decode/edge-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,EACV,OAAO,SAAI,GACV,MAAM,GAAG,SAAS,CAYpB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,EACV,OAAO,SAAI,GACV,MAAM,GAAG,SAAS,CAUpB;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAI5E;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,aAA0C,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC"}
1
+ {"version":3,"file":"edge-context.d.ts","sourceRoot":"","sources":["../../src/decode/edge-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,EACV,OAAO,SAAI,GACV,MAAM,GAAG,SAAS,CAYpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,EACV,OAAO,SAAI,GACV,SAAS,MAAM,EAAE,CAanB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,EACV,OAAO,SAAI,GACV,MAAM,GAAG,SAAS,CAUpB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,EACV,OAAO,SAAI,GACV,SAAS,MAAM,EAAE,CASnB;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAI5E;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,aAA0C,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC"}
@@ -19,6 +19,30 @@ export function wordEndingAt(context, at, longest = 4) {
19
19
  }
20
20
  return undefined;
21
21
  }
22
+ /**
23
+ * Every word the dictionary has ending at a position, longest first.
24
+ *
25
+ * {@link wordEndingAt} answers with the longest, which is what a rule asking
26
+ * "what word is this" wants. A rule asking whether a *particular* word stands
27
+ * here wants all of them, because the longest match is often a word the rule
28
+ * has no opinion about wrapped around the one it does: 很 is a degree adverb
29
+ * and 得很 is the longest word ending at the same position, so 留得很长 hid its
30
+ * 很 and read `zhǎng`. 一个 hides 个 the same way.
31
+ */
32
+ export function wordsEndingAt(context, at, longest = 4) {
33
+ const held = [];
34
+ for (let length = longest; length > 0; length--) {
35
+ const from = at - length;
36
+ if (from < 0) {
37
+ continue;
38
+ }
39
+ const text = context.characters.slice(from, at).join("");
40
+ if (context.dictionary.lookup(text) !== undefined) {
41
+ held.push(text);
42
+ }
43
+ }
44
+ return held;
45
+ }
22
46
  /**
23
47
  * The word starting at a position, longest first, or undefined.
24
48
  */
@@ -33,6 +57,23 @@ export function wordStartingAt(context, at, longest = 4) {
33
57
  }
34
58
  return undefined;
35
59
  }
60
+ /**
61
+ * Every word the dictionary has starting at a position, longest first.
62
+ *
63
+ * The mirror of {@link wordsEndingAt}, and needed for the same reason: 五公 is a
64
+ * word and hides the 五 inside it, so a rule asking whether a numeral starts
65
+ * here has to be shown all of them.
66
+ */
67
+ export function wordsStartingAt(context, at, longest = 4) {
68
+ const held = [];
69
+ for (let length = longest; length > 0; length--) {
70
+ const text = context.characters.slice(at, at + length).join("");
71
+ if (text !== "" && context.dictionary.lookup(text) !== undefined) {
72
+ held.push(text);
73
+ }
74
+ }
75
+ return held;
76
+ }
36
77
  /**
37
78
  * The part of speech the dictionary gives a word, or the empty string.
38
79
  */
@@ -1 +1 @@
1
- {"version":3,"file":"edge-context.js","sourceRoot":"","sources":["../../src/decode/edge-context.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAoB,EACpB,EAAU,EACV,OAAO,GAAG,CAAC;IAEX,KAAK,IAAI,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,EAAE,GAAG,MAAM,CAAC;QACzB,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;YACb,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzD,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YAClD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAoB,EACpB,EAAU,EACV,OAAO,GAAG,CAAC;IAEX,KAAK,IAAI,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;QAChD,mEAAmE;QACnE,sBAAsB;QACtB,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,EAA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AC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAoB,EACpB,EAAU,EACV,OAAO,GAAG,CAAC;IAEX,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,KAAK,IAAI,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChE,IAAI,IAAI,KAAK,EAAE,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACjE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,OAAoB,EAAE,IAAwB;IAClE,OAAO,IAAI,KAAK,SAAS;QACvB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,YAAY,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The two sweeps a decode makes over a whole lattice.
3
+ *
4
+ * Separate from `decode.ts` because the run-level entry points there build a
5
+ * lattice from a run and cut it back down again, where these two take a lattice
6
+ * as given and say nothing about where it came from.
7
+ */
8
+ import { type Lattice } from "./lattice.js";
9
+ import { type ReadingProjection, type ReadingUnit } from "./locking.js";
10
+ /**
11
+ * Decode the run's readings, scoring only where the readings are still open.
12
+ *
13
+ * The asymmetry ALGORITHM.md calls for. A stretch between two cut points whose
14
+ * positions all locked reads the same way on every path, so its readings are
15
+ * read off the locks and no shortest path is run over it at all. Only the
16
+ * stretches with a genuine choice in them are decoded.
17
+ */
18
+ export declare function decodeReadings(lattice: Lattice, projection: ReadingProjection): readonly ReadingUnit[];
19
+ /**
20
+ * Where a decode would put the word boundaries, as character positions.
21
+ *
22
+ * Run over the whole lattice rather than the open stretches, because spacing
23
+ * stays ambiguous where readings do not: 研究生命起源 reads identically whether
24
+ * it splits 研究生/命 or 研究/生命, so every position in it locks, and the
25
+ * spacing question is still open.
26
+ */
27
+ export declare function decodeSpacing(lattice: Lattice): readonly number[];
28
+ //# sourceMappingURL=lattice-decode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lattice-decode.d.ts","sourceRoot":"","sources":["../../src/decode/lattice-decode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAGjB,MAAM,cAAc,CAAC;AAGtB;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,iBAAiB,GAC5B,SAAS,WAAW,EAAE,CAmBxB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAIjE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The two sweeps a decode makes over a whole lattice.
3
+ *
4
+ * Separate from `decode.ts` because the run-level entry points there build a
5
+ * lattice from a run and cut it back down again, where these two take a lattice
6
+ * as given and say nothing about where it came from.
7
+ */
8
+ import { cutPoints } from "./lattice.js";
9
+ import { isSettled, settledUnits, unitsOf, } from "./locking.js";
10
+ import { readingCost, shortestPath, spacingCost } from "./viterbi.js";
11
+ /**
12
+ * Decode the run's readings, scoring only where the readings are still open.
13
+ *
14
+ * The asymmetry ALGORITHM.md calls for. A stretch between two cut points whose
15
+ * positions all locked reads the same way on every path, so its readings are
16
+ * read off the locks and no shortest path is run over it at all. Only the
17
+ * stretches with a genuine choice in them are decoded.
18
+ */
19
+ export function decodeReadings(lattice, projection) {
20
+ const cuts = cutPoints(lattice);
21
+ const units = [];
22
+ for (const [index, from] of cuts.entries()) {
23
+ const to = cuts[index + 1];
24
+ if (to === undefined) {
25
+ break;
26
+ }
27
+ if (isSettled(projection, from, to)) {
28
+ units.push(...settledUnits(projection, from, to));
29
+ continue;
30
+ }
31
+ for (const edge of shortestPath(lattice, from, to, readingCost)) {
32
+ units.push(...unitsOf(edge));
33
+ }
34
+ }
35
+ return units;
36
+ }
37
+ /**
38
+ * Where a decode would put the word boundaries, as character positions.
39
+ *
40
+ * Run over the whole lattice rather than the open stretches, because spacing
41
+ * stays ambiguous where readings do not: 研究生命起源 reads identically whether
42
+ * it splits 研究生/命 or 研究/生命, so every position in it locks, and the
43
+ * spacing question is still open.
44
+ */
45
+ export function decodeSpacing(lattice) {
46
+ return shortestPath(lattice, 0, lattice.characters.length, spacingCost).map((edge) => edge.from);
47
+ }
48
+ //# sourceMappingURL=lattice-decode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lattice-decode.js","sourceRoot":"","sources":["../../src/decode/lattice-decode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAgB,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,SAAS,EAGT,YAAY,EACZ,OAAO,GACR,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtE;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgB,EAChB,UAA6B;IAE7B,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,KAAK,GAAkB,EAAE,CAAC;IAEhC,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC3B,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACrB,MAAM;QACR,CAAC;QACD,IAAI,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;YAClD,SAAS;QACX,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,CAAC,EAAE,CAAC;YAChE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,GAAG,CACzE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CACpB,CAAC;AACJ,CAAC"}
@@ -9,11 +9,27 @@ import { type Lattice } from "./lattice.js";
9
9
  import type { EdgeRule } from "./rules.js";
10
10
  import { type ResolvedHints } from "./hints.js";
11
11
  /**
12
- * A lattice to decode over, and where in it the run itself starts.
12
+ * The 汉字 either side of a run that the decode should see and not report.
13
+ *
14
+ * What a run would have been written with had the digits around it been spelled
15
+ * out. Both sides are the same kind of claim about the same text, so they travel
16
+ * together even where the exported signatures keep them apart.
17
+ */
18
+ export interface DecodeContext {
19
+ /** 汉字 standing in front of the run. */
20
+ readonly before: string;
21
+ /** 汉字 standing after it. */
22
+ readonly after: string;
23
+ }
24
+ /**
25
+ * A lattice to decode over, and where in it the run itself lies.
13
26
  */
14
27
  export interface RunLattice {
15
28
  readonly lattice: Lattice;
29
+ /** Where the run starts, past whatever context stands in front of it. */
16
30
  readonly at: number;
31
+ /** Where the run ends, before whatever context stands after it. */
32
+ readonly to: number;
17
33
  }
18
34
  /**
19
35
  * Whether any reading in the lattice would hold the two sides of a join
@@ -27,11 +43,11 @@ export interface RunLattice {
27
43
  */
28
44
  export declare function isJoinedAt(lattice: Lattice, at: number): boolean;
29
45
  /**
30
- * The lattice a run decodes over, with whatever context stands in front of it.
46
+ * The lattice a run decodes over, with whatever context stands around it.
31
47
  *
32
- * The context is dropped where a reading would hold it to the run, leaving the
33
- * run decoded on its own, which is what it would have been before there was any
34
- * context to give.
48
+ * Each side is dropped where a reading would hold it to the run, and only that
49
+ * side: a run whose trailing context is joined still gets the leading one, which
50
+ * is what it would have had before there was any context to give.
35
51
  */
36
- export declare function runLattice(dictionary: Dictionary, run: string, rules: readonly EdgeRule[], before: string, hints: ResolvedHints | undefined): RunLattice;
52
+ export declare function runLattice(dictionary: Dictionary, run: string, rules: readonly EdgeRule[], context: DecodeContext, hints: ResolvedHints | undefined): RunLattice;
37
53
  //# sourceMappingURL=lattice-slice.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lattice-slice.d.ts","sourceRoot":"","sources":["../../src/decode/lattice-slice.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAG5D;;GAEG;A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MG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,aAAa,GAAG,SAAS,GAC/B,UAAU,CA2BZ"}
@@ -18,26 +18,32 @@ export function isJoinedAt(lattice, at) {
18
18
  edge.reading.length !== edge.to - edge.from);
19
19
  }
20
20
  /**
21
- * The lattice a run decodes over, with whatever context stands in front of it.
21
+ * The lattice a run decodes over, with whatever context stands around it.
22
22
  *
23
- * The context is dropped where a reading would hold it to the run, leaving the
24
- * run decoded on its own, which is what it would have been before there was any
25
- * context to give.
23
+ * Each side is dropped where a reading would hold it to the run, and only that
24
+ * side: a run whose trailing context is joined still gets the leading one, which
25
+ * is what it would have had before there was any context to give.
26
26
  */
27
- export function runLattice(dictionary, run, rules, before, hints) {
28
- const alone = () => ({
29
- lattice: ruledLattice(dictionary, run, rules, hints),
30
- at: 0,
31
- });
32
- if (before === "") {
33
- return alone();
27
+ export function runLattice(dictionary, run, rules, context, hints) {
28
+ const length = toCharacters(run).length;
29
+ const build = (before, after) => {
30
+ const at = toCharacters(before).length;
31
+ // The context is decoded with the run, so every hint position moves along
32
+ // with it. Shifting a copy keeps the caller's positions relative to the run
33
+ // they were given for.
34
+ return {
35
+ lattice: ruledLattice(dictionary, before + run + after, rules, hints === undefined ? undefined : shiftHints(hints, at)),
36
+ at,
37
+ to: at + length,
38
+ };
39
+ };
40
+ const { before, after } = context;
41
+ const held = build(before, after);
42
+ const isLeadJoined = before !== "" && isJoinedAt(held.lattice, held.at);
43
+ const isTailJoined = after !== "" && isJoinedAt(held.lattice, held.to);
44
+ if (!isLeadJoined && !isTailJoined) {
45
+ return held;
34
46
  }
35
- const held = toCharacters(before).length;
36
- // The context is decoded with the run, so every hint position moves along
37
- // with it. Shifting a copy keeps the caller's positions relative to the run
38
- // they were given for.
39
- const lattice = ruledLattice(dictionary, before + run, rules, hints === undefined ? undefined : shiftHints(hints, held));
40
- const at = held;
41
- return isJoinedAt(lattice, at) ? alone() : { lattice, at };
47
+ return build(isLeadJoined ? "" : before, isTailJoined ? "" : after);
42
48
  }
43
49
  //# sourceMappingURL=lattice-slice.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lattice-slice.js","sourceRoot":"","sources":["../../src/decode/lattice-slice.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAsB,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAUhD;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,EAAU;IACrD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAC3B,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,GAAG,EAAE;QACd,IAAI,CAAC,EAAE,GAAG,EAAE;QACZ,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAC9C,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,UAAsB,EACtB,GAAW,EACX,KAA0B,EAC1B,MAAc,EACd,KAAgC;IAEhC,MAAM,KAAK,GAAG,GAAe,EAAE,CAAC,CAAC;QAC/B,OAAO,EAAE,YAAY,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC;QACpD,EAAE,EAAE,CAAC;KACN,CAAC,CAAC;IACH,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;QAClB,OAAO,KAAK,EAAE,CAAC;IACjB,CAAC;IACD,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;IACzC,0EAA0E;IAC1E,4EAA4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EAAE;QAC1D,MAAM,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;QACvC,0EAA0E;QAC1E,4EAA4E;QAC5E,uBAAuB;QACvB,OAAO;YACL,OAAO,EAAE,YAAY,CACnB,UAAU,EACV,MAAM,GAAG,GAAG,GAAG,KAAK,EACpB,KAAK,EACL,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,CACxD;YACD,EAAE;YACF,EAAE,EAAE,EAAE,GAAG,MAAM;SAChB,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAClC,MAAM,YAAY,GAAG,MAAM,KAAK,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACxE,MAAM,YAAY,GAAG,KAAK,KAAK,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACvE,IAAI,CAAC,YAAY,IAAI,CAAC,YAAY,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC"}
@@ -30,14 +30,6 @@ export interface RunContext {
30
30
  * supply, and it is what a 一 ending the number assimilates to.
31
31
  */
32
32
  export declare function surrounding(runs: readonly TextRun[], decoded: readonly (readonly ScoredWord[])[], at: number): RunContext;
33
- /**
34
- * The 汉字 a number in front of a Han run stands for, for that run's decode.
35
- *
36
- * Only the last segment of the run before, because only that one touches the
37
- * Han: the D of 3D银行 comes between them, and a decode of 银行 that saw 三
38
- * beside it would be reading a text nobody wrote.
39
- */
40
- export declare function numeralBefore(segments: readonly NumeralSegment[]): string;
41
33
  /**
42
34
  * Write a stretch that was never Han, reading the numbers in it.
43
35
  *
@@ -1 +1 @@
1
- {"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/decode/numbers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAyB,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,OAAO,EACb,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;KACzC,CAAC;IACF,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,SAAS,OAAO,EAAE,EACxB,OAAO,EAAE,SAAS,CAAC,SAAS,UAAU,EAAE,CAAC,EAAE,EAC3C,EAAE,EAAE,MAAM,GACT,UAAU,CAQZ;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAEzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,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AS,CAAA;CAAE,GACtD,SAAS,cAAc,EAAE,CA6B3B"}
@@ -25,16 +25,6 @@ export function surrounding(runs, decoded, at) {
25
25
  isAfterHan: runs[at - 1]?.isHan === true,
26
26
  };
27
27
  }
28
- /**
29
- * The 汉字 a number in front of a Han run stands for, for that run's decode.
30
- *
31
- * Only the last segment of the run before, because only that one touches the
32
- * Han: the D of 3D银行 comes between them, and a decode of 银行 that saw 三
33
- * beside it would be reading a text nobody wrote.
34
- */
35
- export function numeralBefore(segments) {
36
- return segments.at(-1)?.hanzi ?? "";
37
- }
38
28
  /**
39
29
  * Write a stretch that was never Han, reading the numbers in it.
40
30
  *
@@ -1 +1 @@
1
- {"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src/decode/numbers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrE;;;;;;GAMG;AACH,OAAO,EAAuB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAgB,MAAM,WAAW,CAAC;AAGhE,OAAO,EAEL,UAAU,EACV,WAAW,GAEZ,MAAM,aAAa,CAAC;AAcrB;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,IAAwB,EACxB,OAA2C,EAC3C,EAAU;IAEV,OAAO;QACL,KAAK,EAAE;YACL,SAAS,EAAE,qBAAqB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS;YACpD,QAAQ,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;SAChD;QACD,UAAU,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI;KACzC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,QAAmC;IAC/D,OAAO,QAAQ,CAAC,EA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EzC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,CAAC,IAAI,CACT,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS;YAC/B,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC,CAAC,YAAY,CACV,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,EAC5D,OAAO,EACP,OAAO,CACR,CAAC,CACP,CAAC;QACF,wEAAwE;QACxE,+DAA+D;QAC/D,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,MAAM,CAAC;IACzC,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC;QAC9D,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,4 +1,4 @@
1
- export { MODAL_DE, PARTICLE_DE } from "./de-rule.js";
1
+ export { MODAL_DE, PARTICLE_DE, POTENTIAL_DE } from "./de-rule.js";
2
2
  export { TEACHING_JIAO } from "./jiao-rule.js";
3
3
  import { type EdgeRule } from "./rules.js";
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"reading-rules.d.ts","sourceRoot":"","sources":["../../src/decode/reading-rules.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAEL,KAAK,QAAQ,EAGd,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc,EAAE,QAY5B,CAAC;AAsCF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,eAAe,EAAE,QAuB7B,CAAC;AAIF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,QAAQ,EAQ5C,CAAC"}
1
+ {"version":3,"file":"reading-rules.d.ts","sourceRoot":"","sources":["../../src/decode/reading-rules.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAEL,KAAK,QAAQ,EAGd,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc,EAAE,QAY5B,CAAC;AAsCF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,eAAe,EAAE,QAuB7B,CAAC;AAIF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,QAAQ,EAS5C,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { QUANTITY_CHARACTERS } from "../numerals/characters.js";
2
- import { MODAL_DE, PARTICLE_DE } from "./de-rule.js";
2
+ import { MODAL_DE, PARTICLE_DE, POTENTIAL_DE } from "./de-rule.js";
3
3
  import { TEACHING_JIAO } from "./jiao-rule.js";
4
- export { MODAL_DE, PARTICLE_DE } from "./de-rule.js";
4
+ export { MODAL_DE, PARTICLE_DE, POTENTIAL_DE } from "./de-rule.js";
5
5
  export { TEACHING_JIAO } from "./jiao-rule.js";
6
6
  import { toCharacters } from "../script/characters.js";
7
7
  import { tagOf, wordEndingAt, } from "./rules.js";
@@ -129,6 +129,7 @@ export { ADJECTIVAL_CHANG, PLAYING_TAN } from "./polyphone-rules.js";
129
129
  export const READING_RULES = [
130
130
  MODAL_DE,
131
131
  PARTICLE_DE,
132
+ POTENTIAL_DE,
132
133
  TEACHING_JIAO,
133
134
  ATTESTED_ERHUA,
134
135
  COUNTED_MEASURE,
@@ -1 +1 @@
1
- {"version":3,"file":"reading-rules.js","sourceRoot":"","sources":["../../src/decode/reading-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAGL,KAAK,EACL,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAa;IACtC,IAAI,EAAE,gBAAgB;IACtB,UAAU,EAAE,CAAC,OAAoB,EAAE,EAAE;QACnC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACrC,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACzC,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,wEAAwE;QACxE,MAAM,QAAQ,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,GA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,CAAC,CAAC,KAAK,OAAO;YACtD,IAAI,CAAC,YAAY,KAAK,OAAO;YAC7B,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,MAAM,CAAC;IACb,CAAC;CACF,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAwB;IAChD,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,aAAa;IACb,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,WAAW;CACZ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { Dictionary } from "../dictionary/dictionary.js";
2
2
  import type { Lattice, LatticeEdge } from "./lattice.js";
3
- export { ASPECT, PARTICLE_TAG, tagOf, wordEndingAt, wordStartingAt, } from "./edge-context.js";
3
+ export { ASPECT, PARTICLE_TAG, tagOf, wordEndingAt, wordsEndingAt, wordStartingAt, wordsStartingAt, } from "./edge-context.js";
4
4
  /**
5
5
  * What a rule can say about one edge.
6
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/decode/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAA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AAU,EACtB,KAAK,EAAE,SAAS,QAAQ,EAAE,GACzB,OAAO,CAsCT"}
@@ -1,4 +1,4 @@
1
- export { ASPECT, PARTICLE_TAG, tagOf, wordEndingAt, wordStartingAt, } from "./edge-context.js";
1
+ export { ASPECT, PARTICLE_TAG, tagOf, wordEndingAt, wordsEndingAt, wordStartingAt, wordsStartingAt, } from "./edge-context.js";
2
2
  /**
3
3
  * Whether every position can still be left, and the end still reached.
4
4
  *