@kensio/pinyinjs 1.7.4 → 1.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -123
- package/data/full.entries +2595 -2595
- package/data/manifest.json +5 -5
- package/data/script.map +66 -3
- package/dist/accuracy/score-case.d.ts +23 -0
- package/dist/accuracy/score-case.d.ts.map +1 -0
- package/dist/accuracy/score-case.js +63 -0
- package/dist/accuracy/score-case.js.map +1 -0
- package/dist/accuracy/score.d.ts +1 -8
- package/dist/accuracy/score.d.ts.map +1 -1
- package/dist/accuracy/score.js +1 -55
- package/dist/accuracy/score.js.map +1 -1
- package/dist/cli/arguments.d.ts +4 -290
- package/dist/cli/arguments.d.ts.map +1 -1
- package/dist/cli/arguments.js +5 -357
- package/dist/cli/arguments.js.map +1 -1
- package/dist/cli/check-command.d.ts +9 -0
- package/dist/cli/check-command.d.ts.map +1 -0
- package/dist/cli/check-command.js +95 -0
- package/dist/cli/check-command.js.map +1 -0
- package/dist/cli/cli-input.d.ts +49 -0
- package/dist/cli/cli-input.d.ts.map +1 -0
- package/dist/cli/cli-input.js +31 -0
- package/dist/cli/cli-input.js.map +1 -0
- package/dist/cli/command.d.ts +97 -0
- package/dist/cli/command.d.ts.map +1 -0
- package/dist/cli/command.js +40 -0
- package/dist/cli/command.js.map +1 -0
- package/dist/cli/commands.d.ts +7 -110
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +14 -991
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/convert-command.d.ts +6 -0
- package/dist/cli/convert-command.d.ts.map +1 -0
- package/dist/cli/convert-command.js +52 -0
- package/dist/cli/convert-command.js.map +1 -0
- package/dist/cli/environment.d.ts +1 -1
- package/dist/cli/environment.d.ts.map +1 -1
- package/dist/cli/explain-command.d.ts +6 -0
- package/dist/cli/explain-command.d.ts.map +1 -0
- package/dist/cli/explain-command.js +40 -0
- package/dist/cli/explain-command.js.map +1 -0
- package/dist/cli/explain-syllable.d.ts +10 -0
- package/dist/cli/explain-syllable.d.ts.map +1 -0
- package/dist/cli/explain-syllable.js +70 -0
- package/dist/cli/explain-syllable.js.map +1 -0
- package/dist/cli/flag-help.d.ts +18 -0
- package/dist/cli/flag-help.d.ts.map +1 -0
- package/dist/cli/flag-help.js +78 -0
- package/dist/cli/flag-help.js.map +1 -0
- package/dist/cli/flag-lists.d.ts +49 -0
- package/dist/cli/flag-lists.d.ts.map +1 -0
- package/dist/cli/flag-lists.js +58 -0
- package/dist/cli/flag-lists.js.map +1 -0
- package/dist/cli/flag-values.d.ts +44 -0
- package/dist/cli/flag-values.d.ts.map +1 -0
- package/dist/cli/flag-values.js +56 -0
- package/dist/cli/flag-values.js.map +1 -0
- package/dist/cli/flags.d.ts +193 -0
- package/dist/cli/flags.d.ts.map +1 -0
- package/dist/cli/flags.js +133 -0
- package/dist/cli/flags.js.map +1 -0
- package/dist/cli/format-options.d.ts +29 -0
- package/dist/cli/format-options.d.ts.map +1 -0
- package/dist/cli/format-options.js +72 -0
- package/dist/cli/format-options.js.map +1 -0
- package/dist/cli/global-help.d.ts +23 -0
- package/dist/cli/global-help.d.ts.map +1 -0
- package/dist/cli/global-help.js +40 -0
- package/dist/cli/global-help.js.map +1 -0
- package/dist/cli/help.d.ts +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +5 -99
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/html-commands.d.ts +13 -0
- package/dist/cli/html-commands.d.ts.map +1 -0
- package/dist/cli/html-commands.js +49 -0
- package/dist/cli/html-commands.js.map +1 -0
- package/dist/cli/info-command.d.ts +7 -0
- package/dist/cli/info-command.d.ts.map +1 -0
- package/dist/cli/info-command.js +39 -0
- package/dist/cli/info-command.js.map +1 -0
- package/dist/cli/lookup-commands.d.ts +10 -0
- package/dist/cli/lookup-commands.d.ts.map +1 -0
- package/dist/cli/lookup-commands.js +101 -0
- package/dist/cli/lookup-commands.js.map +1 -0
- package/dist/cli/match-command.d.ts +11 -0
- package/dist/cli/match-command.d.ts.map +1 -0
- package/dist/cli/match-command.js +76 -0
- package/dist/cli/match-command.js.map +1 -0
- package/dist/cli/number-command.d.ts +12 -0
- package/dist/cli/number-command.d.ts.map +1 -0
- package/dist/cli/number-command.js +89 -0
- package/dist/cli/number-command.js.map +1 -0
- package/dist/cli/options.d.ts +30 -0
- package/dist/cli/options.d.ts.map +1 -0
- package/dist/cli/options.js +54 -0
- package/dist/cli/options.js.map +1 -0
- package/dist/cli/run-command.d.ts +24 -0
- package/dist/cli/run-command.d.ts.map +1 -0
- package/dist/cli/run-command.js +40 -0
- package/dist/cli/run-command.js.map +1 -0
- package/dist/cli/run.d.ts +4 -42
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +6 -61
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/script-command.d.ts +10 -0
- package/dist/cli/script-command.d.ts.map +1 -0
- package/dist/cli/script-command.js +58 -0
- package/dist/cli/script-command.js.map +1 -0
- package/dist/cli/segment-command.d.ts +11 -0
- package/dist/cli/segment-command.d.ts.map +1 -0
- package/dist/cli/segment-command.js +53 -0
- package/dist/cli/segment-command.js.map +1 -0
- package/dist/cli/slug-command.d.ts +10 -0
- package/dist/cli/slug-command.d.ts.map +1 -0
- package/dist/cli/slug-command.js +28 -0
- package/dist/cli/slug-command.js.map +1 -0
- package/dist/cli/syllable-command.d.ts +14 -0
- package/dist/cli/syllable-command.d.ts.map +1 -0
- package/dist/cli/syllable-command.js +82 -0
- package/dist/cli/syllable-command.js.map +1 -0
- package/dist/cli/system-table.d.ts +12 -0
- package/dist/cli/system-table.d.ts.map +1 -0
- package/dist/cli/system-table.js +48 -0
- package/dist/cli/system-table.js.map +1 -0
- package/dist/cli/systems.d.ts +57 -0
- package/dist/cli/systems.d.ts.map +1 -0
- package/dist/cli/systems.js +27 -0
- package/dist/cli/systems.js.map +1 -0
- package/dist/cli/transcribe-command.d.ts +18 -0
- package/dist/cli/transcribe-command.d.ts.map +1 -0
- package/dist/cli/transcribe-command.js +86 -0
- package/dist/cli/transcribe-command.js.map +1 -0
- package/dist/cli/transcribe-reading.d.ts +15 -0
- package/dist/cli/transcribe-reading.d.ts.map +1 -0
- package/dist/cli/transcribe-reading.js +90 -0
- package/dist/cli/transcribe-reading.js.map +1 -0
- package/dist/cli/transcribe-rows.d.ts +26 -0
- package/dist/cli/transcribe-rows.d.ts.map +1 -0
- package/dist/cli/transcribe-rows.js +30 -0
- package/dist/cli/transcribe-rows.js.map +1 -0
- package/dist/cli/usage-error.d.ts +9 -0
- package/dist/cli/usage-error.d.ts.map +1 -0
- package/dist/cli/usage-error.js +9 -0
- package/dist/cli/usage-error.js.map +1 -0
- package/dist/decode/alternatives.d.ts +16 -0
- package/dist/decode/alternatives.d.ts.map +1 -0
- package/dist/decode/alternatives.js +31 -0
- package/dist/decode/alternatives.js.map +1 -0
- package/dist/decode/chang-context.d.ts +27 -0
- package/dist/decode/chang-context.d.ts.map +1 -0
- package/dist/decode/chang-context.js +66 -0
- package/dist/decode/chang-context.js.map +1 -0
- package/dist/decode/chang-rule.d.ts +37 -0
- package/dist/decode/chang-rule.d.ts.map +1 -0
- package/dist/decode/chang-rule.js +169 -0
- package/dist/decode/chang-rule.js.map +1 -0
- package/dist/decode/confidence.d.ts +11 -3
- package/dist/decode/confidence.d.ts.map +1 -1
- package/dist/decode/confidence.js +14 -121
- package/dist/decode/confidence.js.map +1 -1
- package/dist/decode/convert-options.d.ts +116 -0
- package/dist/decode/convert-options.d.ts.map +1 -0
- package/dist/decode/convert-options.js +2 -0
- package/dist/decode/convert-options.js.map +1 -0
- package/dist/decode/convert-pipeline.d.ts +18 -0
- package/dist/decode/convert-pipeline.d.ts.map +1 -0
- package/dist/decode/convert-pipeline.js +67 -0
- package/dist/decode/convert-pipeline.js.map +1 -0
- package/dist/decode/convert.d.ts +9 -118
- package/dist/decode/convert.d.ts.map +1 -1
- package/dist/decode/convert.js +5 -453
- package/dist/decode/convert.js.map +1 -1
- package/dist/decode/de-rule.d.ts +54 -0
- package/dist/decode/de-rule.d.ts.map +1 -0
- package/dist/decode/de-rule.js +113 -0
- package/dist/decode/de-rule.js.map +1 -0
- package/dist/decode/decode.d.ts +2 -15
- package/dist/decode/decode.d.ts.map +1 -1
- package/dist/decode/decode.js +2 -121
- package/dist/decode/decode.js.map +1 -1
- package/dist/decode/decoders.d.ts +32 -0
- package/dist/decode/decoders.d.ts.map +1 -0
- package/dist/decode/decoders.js +29 -0
- package/dist/decode/decoders.js.map +1 -0
- package/dist/decode/edge-context.d.ts +38 -0
- package/dist/decode/edge-context.d.ts.map +1 -0
- package/dist/decode/edge-context.js +57 -0
- package/dist/decode/edge-context.js.map +1 -0
- package/dist/decode/hint-lattice.d.ts +45 -0
- package/dist/decode/hint-lattice.d.ts.map +1 -0
- package/dist/decode/hint-lattice.js +154 -0
- package/dist/decode/hint-lattice.js.map +1 -0
- package/dist/decode/hints.d.ts +2 -45
- package/dist/decode/hints.d.ts.map +1 -1
- package/dist/decode/hints.js +1 -139
- package/dist/decode/hints.js.map +1 -1
- package/dist/decode/jiao-rule.d.ts +64 -0
- package/dist/decode/jiao-rule.d.ts.map +1 -0
- package/dist/decode/jiao-rule.js +115 -0
- package/dist/decode/jiao-rule.js.map +1 -0
- package/dist/decode/lattice-costs.d.ts +55 -0
- package/dist/decode/lattice-costs.d.ts.map +1 -0
- package/dist/decode/lattice-costs.js +90 -0
- package/dist/decode/lattice-costs.js.map +1 -0
- package/dist/decode/lattice-edges.d.ts +29 -0
- package/dist/decode/lattice-edges.d.ts.map +1 -0
- package/dist/decode/lattice-edges.js +78 -0
- package/dist/decode/lattice-edges.js.map +1 -0
- package/dist/decode/lattice-slice.d.ts +37 -0
- package/dist/decode/lattice-slice.d.ts.map +1 -0
- package/dist/decode/lattice-slice.js +43 -0
- package/dist/decode/lattice-slice.js.map +1 -0
- package/dist/decode/lattice-types.d.ts +101 -0
- package/dist/decode/lattice-types.d.ts.map +1 -0
- package/dist/decode/lattice-types.js +63 -0
- package/dist/decode/lattice-types.js.map +1 -0
- package/dist/decode/lattice.d.ts +2 -59
- package/dist/decode/lattice.d.ts.map +1 -1
- package/dist/decode/lattice.js +2 -118
- package/dist/decode/lattice.js.map +1 -1
- package/dist/decode/number-pieces.d.ts +62 -0
- package/dist/decode/number-pieces.d.ts.map +1 -0
- package/dist/decode/number-pieces.js +106 -0
- package/dist/decode/number-pieces.js.map +1 -0
- package/dist/decode/numbers.d.ts +53 -0
- package/dist/decode/numbers.d.ts.map +1 -0
- package/dist/decode/numbers.js +69 -0
- package/dist/decode/numbers.js.map +1 -0
- package/dist/decode/pieces.d.ts +78 -0
- package/dist/decode/pieces.d.ts.map +1 -0
- package/dist/decode/pieces.js +136 -0
- package/dist/decode/pieces.js.map +1 -0
- package/dist/decode/polyphone-rules.d.ts +11 -0
- package/dist/decode/polyphone-rules.d.ts.map +1 -0
- package/dist/decode/polyphone-rules.js +11 -0
- package/dist/decode/polyphone-rules.js.map +1 -0
- package/dist/decode/reading-rules.d.ts +3 -126
- package/dist/decode/reading-rules.d.ts.map +1 -1
- package/dist/decode/reading-rules.js +8 -434
- package/dist/decode/reading-rules.js.map +1 -1
- package/dist/decode/rules.d.ts +1 -17
- package/dist/decode/rules.d.ts.map +1 -1
- package/dist/decode/rules.js +1 -43
- package/dist/decode/rules.js.map +1 -1
- package/dist/decode/run-lattice.d.ts +52 -0
- package/dist/decode/run-lattice.d.ts.map +1 -0
- package/dist/decode/run-lattice.js +91 -0
- package/dist/decode/run-lattice.js.map +1 -0
- package/dist/decode/run-words.d.ts +17 -0
- package/dist/decode/run-words.d.ts.map +1 -0
- package/dist/decode/run-words.js +29 -0
- package/dist/decode/run-words.js.map +1 -0
- package/dist/decode/sandhi-input.d.ts +30 -0
- package/dist/decode/sandhi-input.d.ts.map +1 -0
- package/dist/decode/sandhi-input.js +35 -0
- package/dist/decode/sandhi-input.js.map +1 -0
- package/dist/decode/sandhi-tones.d.ts +97 -0
- package/dist/decode/sandhi-tones.d.ts.map +1 -0
- package/dist/decode/sandhi-tones.js +139 -0
- package/dist/decode/sandhi-tones.js.map +1 -0
- package/dist/decode/sandhi.d.ts +10 -7
- package/dist/decode/sandhi.d.ts.map +1 -1
- package/dist/decode/sandhi.js +11 -88
- package/dist/decode/sandhi.js.map +1 -1
- package/dist/decode/script-types.d.ts +76 -0
- package/dist/decode/script-types.d.ts.map +1 -0
- package/dist/decode/script-types.js +35 -0
- package/dist/decode/script-types.js.map +1 -0
- package/dist/decode/script-words.d.ts +32 -0
- package/dist/decode/script-words.d.ts.map +1 -0
- package/dist/decode/script-words.js +77 -0
- package/dist/decode/script-words.js.map +1 -0
- package/dist/decode/script.d.ts +3 -73
- package/dist/decode/script.d.ts.map +1 -1
- package/dist/decode/script.js +3 -109
- package/dist/decode/script.js.map +1 -1
- package/dist/decode/tan-rule.d.ts +68 -0
- package/dist/decode/tan-rule.d.ts.map +1 -0
- package/dist/decode/tan-rule.js +131 -0
- package/dist/decode/tan-rule.js.map +1 -0
- package/dist/decode/write-run.d.ts +21 -0
- package/dist/decode/write-run.d.ts.map +1 -0
- package/dist/decode/write-run.js +42 -0
- package/dist/decode/write-run.js.map +1 -0
- package/dist/dictionary/artifact-claims.d.ts +25 -0
- package/dist/dictionary/artifact-claims.d.ts.map +1 -0
- package/dist/dictionary/artifact-claims.js +47 -0
- package/dist/dictionary/artifact-claims.js.map +1 -0
- package/dist/dictionary/artifact-format.d.ts +86 -0
- package/dist/dictionary/artifact-format.d.ts.map +1 -0
- package/dist/dictionary/artifact-format.js +91 -0
- package/dist/dictionary/artifact-format.js.map +1 -0
- package/dist/dictionary/artifact-read.d.ts +34 -0
- package/dist/dictionary/artifact-read.d.ts.map +1 -0
- package/dist/dictionary/artifact-read.js +114 -0
- package/dist/dictionary/artifact-read.js.map +1 -0
- package/dist/dictionary/artifact.d.ts +4 -63
- package/dist/dictionary/artifact.d.ts.map +1 -1
- package/dist/dictionary/artifact.js +12 -229
- package/dist/dictionary/artifact.js.map +1 -1
- package/dist/dictionary/assertions.d.ts +5 -57
- package/dist/dictionary/assertions.d.ts.map +1 -1
- package/dist/dictionary/assertions.js +4 -317
- package/dist/dictionary/assertions.js.map +1 -1
- package/dist/dictionary/build-assertions.d.ts +12 -0
- package/dist/dictionary/build-assertions.d.ts.map +1 -0
- package/dist/dictionary/build-assertions.js +13 -0
- package/dist/dictionary/build-assertions.js.map +1 -0
- package/dist/dictionary/built-dictionary.d.ts +46 -0
- package/dist/dictionary/built-dictionary.d.ts.map +1 -0
- package/dist/dictionary/built-dictionary.js +97 -0
- package/dist/dictionary/built-dictionary.js.map +1 -0
- package/dist/dictionary/cedict-senses.d.ts +87 -0
- package/dist/dictionary/cedict-senses.d.ts.map +1 -0
- package/dist/dictionary/cedict-senses.js +126 -0
- package/dist/dictionary/cedict-senses.js.map +1 -0
- package/dist/dictionary/character-defaults.d.ts +26 -0
- package/dist/dictionary/character-defaults.d.ts.map +1 -0
- package/dist/dictionary/character-defaults.js +67 -0
- package/dist/dictionary/character-defaults.js.map +1 -0
- package/dist/dictionary/character-readings.d.ts +10 -0
- package/dist/dictionary/character-readings.d.ts.map +1 -0
- package/dist/dictionary/character-readings.js +25 -0
- package/dist/dictionary/character-readings.js.map +1 -0
- package/dist/dictionary/constituent-repair.d.ts +36 -0
- package/dist/dictionary/constituent-repair.d.ts.map +1 -0
- package/dist/dictionary/constituent-repair.js +117 -0
- package/dist/dictionary/constituent-repair.js.map +1 -0
- package/dist/dictionary/dictionary-entry.d.ts +37 -0
- package/dist/dictionary/dictionary-entry.d.ts.map +1 -0
- package/dist/dictionary/dictionary-entry.js +41 -0
- package/dist/dictionary/dictionary-entry.js.map +1 -0
- package/dist/dictionary/dictionary-readings.d.ts +56 -0
- package/dist/dictionary/dictionary-readings.d.ts.map +1 -0
- package/dist/dictionary/dictionary-readings.js +93 -0
- package/dist/dictionary/dictionary-readings.js.map +1 -0
- package/dist/dictionary/dictionary.d.ts +6 -60
- package/dist/dictionary/dictionary.d.ts.map +1 -1
- package/dist/dictionary/dictionary.js +9 -169
- package/dist/dictionary/dictionary.js.map +1 -1
- package/dist/dictionary/entry-invariants.d.ts +3 -0
- package/dist/dictionary/entry-invariants.d.ts.map +1 -0
- package/dist/dictionary/entry-invariants.js +67 -0
- package/dist/dictionary/entry-invariants.js.map +1 -0
- package/dist/dictionary/entry-lines.d.ts +35 -0
- package/dist/dictionary/entry-lines.d.ts.map +1 -0
- package/dist/dictionary/entry-lines.js +70 -0
- package/dist/dictionary/entry-lines.js.map +1 -0
- package/dist/dictionary/erhua-repair.d.ts +26 -0
- package/dist/dictionary/erhua-repair.d.ts.map +1 -0
- package/dist/dictionary/erhua-repair.js +49 -0
- package/dist/dictionary/erhua-repair.js.map +1 -0
- package/dist/dictionary/frequency-tones.d.ts +74 -0
- package/dist/dictionary/frequency-tones.d.ts.map +1 -0
- package/dist/dictionary/frequency-tones.js +128 -0
- package/dist/dictionary/frequency-tones.js.map +1 -0
- package/dist/dictionary/inventory-invariants.d.ts +3 -0
- package/dist/dictionary/inventory-invariants.d.ts.map +1 -0
- package/dist/dictionary/inventory-invariants.js +54 -0
- package/dist/dictionary/inventory-invariants.js.map +1 -0
- package/dist/dictionary/locale-candidates.d.ts +40 -0
- package/dist/dictionary/locale-candidates.d.ts.map +1 -0
- package/dist/dictionary/locale-candidates.js +77 -0
- package/dist/dictionary/locale-candidates.js.map +1 -0
- package/dist/dictionary/locale-segments.d.ts +47 -0
- package/dist/dictionary/locale-segments.d.ts.map +1 -0
- package/dist/dictionary/locale-segments.js +141 -0
- package/dist/dictionary/locale-segments.js.map +1 -0
- package/dist/dictionary/locale.d.ts +1 -21
- package/dist/dictionary/locale.d.ts.map +1 -1
- package/dist/dictionary/locale.js +9 -198
- package/dist/dictionary/locale.js.map +1 -1
- package/dist/dictionary/merge-types.d.ts +127 -0
- package/dist/dictionary/merge-types.d.ts.map +1 -0
- package/dist/dictionary/merge-types.js +35 -0
- package/dist/dictionary/merge-types.js.map +1 -0
- package/dist/dictionary/merge-walk.d.ts +27 -0
- package/dist/dictionary/merge-walk.d.ts.map +1 -0
- package/dist/dictionary/merge-walk.js +49 -0
- package/dist/dictionary/merge-walk.js.map +1 -0
- package/dist/dictionary/merge-word.d.ts +7 -0
- package/dist/dictionary/merge-word.d.ts.map +1 -0
- package/dist/dictionary/merge-word.js +91 -0
- package/dist/dictionary/merge-word.js.map +1 -0
- package/dist/dictionary/merge.d.ts +5 -62
- package/dist/dictionary/merge.d.ts.map +1 -1
- package/dist/dictionary/merge.js +32 -725
- package/dist/dictionary/merge.js.map +1 -1
- package/dist/dictionary/proper-noun.d.ts +28 -0
- package/dist/dictionary/proper-noun.d.ts.map +1 -0
- package/dist/dictionary/proper-noun.js +43 -0
- package/dist/dictionary/proper-noun.js.map +1 -0
- package/dist/dictionary/reading-agreement.d.ts +71 -0
- package/dist/dictionary/reading-agreement.d.ts.map +1 -0
- package/dist/dictionary/reading-agreement.js +156 -0
- package/dist/dictionary/reading-agreement.js.map +1 -0
- package/dist/dictionary/script-conversion.d.ts +28 -0
- package/dist/dictionary/script-conversion.d.ts.map +1 -0
- package/dist/dictionary/script-conversion.js +58 -0
- package/dist/dictionary/script-conversion.js.map +1 -0
- package/dist/dictionary/script-pairings.d.ts +74 -0
- package/dist/dictionary/script-pairings.d.ts.map +1 -0
- package/dist/dictionary/script-pairings.js +120 -0
- package/dist/dictionary/script-pairings.js.map +1 -0
- package/dist/dictionary/script-tables.d.ts.map +1 -1
- package/dist/dictionary/script-tables.js +2 -165
- package/dist/dictionary/script-tables.js.map +1 -1
- package/dist/dictionary/taiwan-reading.d.ts +8 -0
- package/dist/dictionary/taiwan-reading.d.ts.map +1 -0
- package/dist/dictionary/taiwan-reading.js +38 -0
- package/dist/dictionary/taiwan-reading.js.map +1 -0
- package/dist/dictionary/tone-invariants.d.ts +3 -0
- package/dist/dictionary/tone-invariants.d.ts.map +1 -0
- package/dist/dictionary/tone-invariants.js +64 -0
- package/dist/dictionary/tone-invariants.js.map +1 -0
- package/dist/dictionary/traditional-form.d.ts +21 -0
- package/dist/dictionary/traditional-form.d.ts.map +1 -0
- package/dist/dictionary/traditional-form.js +59 -0
- package/dist/dictionary/traditional-form.js.map +1 -0
- package/dist/dictionary/traditional-ranking.d.ts +22 -0
- package/dist/dictionary/traditional-ranking.d.ts.map +1 -0
- package/dist/dictionary/traditional-ranking.js +74 -0
- package/dist/dictionary/traditional-ranking.js.map +1 -0
- package/dist/dictionary/traditional-table.d.ts +51 -0
- package/dist/dictionary/traditional-table.d.ts.map +1 -0
- package/dist/dictionary/traditional-table.js +98 -0
- package/dist/dictionary/traditional-table.js.map +1 -0
- package/dist/dictionary/traditional.d.ts +3 -56
- package/dist/dictionary/traditional.d.ts.map +1 -1
- package/dist/dictionary/traditional.js +3 -186
- package/dist/dictionary/traditional.js.map +1 -1
- package/dist/dictionary/variant-counts.d.ts +39 -0
- package/dist/dictionary/variant-counts.d.ts.map +1 -0
- package/dist/dictionary/variant-counts.js +38 -0
- package/dist/dictionary/variant-counts.js.map +1 -0
- package/dist/dictionary/word-reading.d.ts +26 -0
- package/dist/dictionary/word-reading.d.ts.map +1 -0
- package/dist/dictionary/word-reading.js +76 -0
- package/dist/dictionary/word-reading.js.map +1 -0
- package/dist/dictionary/word-readings.d.ts +15 -0
- package/dist/dictionary/word-readings.d.ts.map +1 -0
- package/dist/dictionary/word-readings.js +41 -0
- package/dist/dictionary/word-readings.js.map +1 -0
- package/dist/format/annotate.d.ts +90 -0
- package/dist/format/annotate.d.ts.map +1 -0
- package/dist/format/annotate.js +168 -0
- package/dist/format/annotate.js.map +1 -0
- package/dist/format/html.d.ts +15 -46
- package/dist/format/html.d.ts.map +1 -1
- package/dist/format/html.js +3 -162
- package/dist/format/html.js.map +1 -1
- package/dist/format/slug-hash.d.ts +51 -0
- package/dist/format/slug-hash.d.ts.map +1 -0
- package/dist/format/slug-hash.js +74 -0
- package/dist/format/slug-hash.js.map +1 -0
- package/dist/format/slug-options.d.ts +98 -0
- package/dist/format/slug-options.d.ts.map +1 -0
- package/dist/format/slug-options.js +2 -0
- package/dist/format/slug-options.js.map +1 -0
- package/dist/format/slug-words.d.ts +27 -0
- package/dist/format/slug-words.d.ts.map +1 -0
- package/dist/format/slug-words.js +0 -0
- package/dist/format/slug-words.js.map +1 -0
- package/dist/format/slug.d.ts +3 -128
- package/dist/format/slug.d.ts.map +1 -1
- package/dist/format/slug.js +0 -0
- package/dist/format/slug.js.map +1 -1
- package/dist/grade/check-readings.d.ts +41 -0
- package/dist/grade/check-readings.d.ts.map +1 -0
- package/dist/grade/check-readings.js +36 -0
- package/dist/grade/check-readings.js.map +1 -0
- package/dist/grade/check.d.ts +4 -4
- package/dist/grade/check.d.ts.map +1 -1
- package/dist/grade/check.js +5 -270
- package/dist/grade/check.js.map +1 -1
- package/dist/grade/pair-syllables.d.ts +48 -0
- package/dist/grade/pair-syllables.d.ts.map +1 -0
- package/dist/grade/pair-syllables.js +71 -0
- package/dist/grade/pair-syllables.js.map +1 -0
- package/dist/grade/reading-syllables.d.ts +62 -0
- package/dist/grade/reading-syllables.d.ts.map +1 -0
- package/dist/grade/reading-syllables.js +58 -0
- package/dist/grade/reading-syllables.js.map +1 -0
- package/dist/grade/reading-tolerance.d.ts +72 -0
- package/dist/grade/reading-tolerance.d.ts.map +1 -0
- package/dist/grade/reading-tolerance.js +107 -0
- package/dist/grade/reading-tolerance.js.map +1 -0
- package/dist/grade/typed-reading.d.ts +28 -0
- package/dist/grade/typed-reading.d.ts.map +1 -0
- package/dist/grade/typed-reading.js +36 -0
- package/dist/grade/typed-reading.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/numerals/numeral-parse.d.ts +32 -0
- package/dist/numerals/numeral-parse.d.ts.map +1 -0
- package/dist/numerals/numeral-parse.js +44 -0
- package/dist/numerals/numeral-parse.js.map +1 -0
- package/dist/numerals/numeral-shapes.d.ts +89 -0
- package/dist/numerals/numeral-shapes.d.ts.map +1 -0
- package/dist/numerals/numeral-shapes.js +99 -0
- package/dist/numerals/numeral-shapes.js.map +1 -0
- package/dist/numerals/numerals.d.ts.map +1 -1
- package/dist/numerals/numerals.js +2 -36
- package/dist/numerals/numerals.js.map +1 -1
- package/dist/numerals/read-numeral.d.ts +76 -0
- package/dist/numerals/read-numeral.d.ts.map +1 -0
- package/dist/numerals/read-numeral.js +88 -0
- package/dist/numerals/read-numeral.js.map +1 -0
- package/dist/numerals/text.d.ts +3 -37
- package/dist/numerals/text.d.ts.map +1 -1
- package/dist/numerals/text.js +3 -254
- package/dist/numerals/text.js.map +1 -1
- package/dist/numerals/time.d.ts +34 -0
- package/dist/numerals/time.d.ts.map +1 -0
- package/dist/numerals/time.js +93 -0
- package/dist/numerals/time.js.map +1 -0
- package/dist/orthography/address-grouping.d.ts +34 -0
- package/dist/orthography/address-grouping.d.ts.map +1 -0
- package/dist/orthography/address-grouping.js +52 -0
- package/dist/orthography/address-grouping.js.map +1 -0
- package/dist/orthography/grouping.d.ts +3 -87
- package/dist/orthography/grouping.d.ts.map +1 -1
- package/dist/orthography/grouping.js +4 -270
- package/dist/orthography/grouping.js.map +1 -1
- package/dist/orthography/place-grouping.d.ts +39 -0
- package/dist/orthography/place-grouping.d.ts.map +1 -0
- package/dist/orthography/place-grouping.js +83 -0
- package/dist/orthography/place-grouping.js.map +1 -0
- package/dist/orthography/word-grouping.d.ts +48 -0
- package/dist/orthography/word-grouping.d.ts.map +1 -0
- package/dist/orthography/word-grouping.js +147 -0
- package/dist/orthography/word-grouping.js.map +1 -0
- package/dist/script/conversion-format.d.ts +22 -0
- package/dist/script/conversion-format.d.ts.map +1 -0
- package/dist/script/conversion-format.js +22 -0
- package/dist/script/conversion-format.js.map +1 -0
- package/dist/script/conversion-read.d.ts +9 -0
- package/dist/script/conversion-read.d.ts.map +1 -0
- package/dist/script/conversion-read.js +69 -0
- package/dist/script/conversion-read.js.map +1 -0
- package/dist/script/conversion-write.d.ts +14 -0
- package/dist/script/conversion-write.d.ts.map +1 -0
- package/dist/script/conversion-write.js +34 -0
- package/dist/script/conversion-write.js.map +1 -0
- package/dist/script/conversion.d.ts +10 -16
- package/dist/script/conversion.d.ts.map +1 -1
- package/dist/script/conversion.js +2 -115
- package/dist/script/conversion.js.map +1 -1
- package/dist/search/candidate-narrowing.d.ts +56 -0
- package/dist/search/candidate-narrowing.d.ts.map +1 -0
- package/dist/search/candidate-narrowing.js +55 -0
- package/dist/search/candidate-narrowing.js.map +1 -0
- package/dist/search/candidate-query.d.ts +25 -0
- package/dist/search/candidate-query.d.ts.map +1 -0
- package/dist/search/candidate-query.js +28 -0
- package/dist/search/candidate-query.js.map +1 -0
- package/dist/search/candidate-writings.d.ts +24 -0
- package/dist/search/candidate-writings.d.ts.map +1 -0
- package/dist/search/candidate-writings.js +114 -0
- package/dist/search/candidate-writings.js.map +1 -0
- package/dist/search/candidates.d.ts +7 -41
- package/dist/search/candidates.d.ts.map +1 -1
- package/dist/search/candidates.js +10 -164
- package/dist/search/candidates.js.map +1 -1
- package/dist/search/match-chunks.d.ts +19 -0
- package/dist/search/match-chunks.d.ts.map +1 -0
- package/dist/search/match-chunks.js +30 -0
- package/dist/search/match-chunks.js.map +1 -0
- package/dist/search/match-ranking.d.ts +39 -0
- package/dist/search/match-ranking.d.ts.map +1 -0
- package/dist/search/match-ranking.js +51 -0
- package/dist/search/match-ranking.js.map +1 -0
- package/dist/search/match-readings.d.ts +43 -0
- package/dist/search/match-readings.d.ts.map +1 -0
- package/dist/search/match-readings.js +83 -0
- package/dist/search/match-readings.js.map +1 -0
- package/dist/search/match-scoring.d.ts +146 -0
- package/dist/search/match-scoring.d.ts.map +1 -0
- package/dist/search/match-scoring.js +114 -0
- package/dist/search/match-scoring.js.map +1 -0
- package/dist/search/match-search.d.ts +28 -0
- package/dist/search/match-search.d.ts.map +1 -0
- package/dist/search/match-search.js +128 -0
- package/dist/search/match-search.js.map +1 -0
- package/dist/search/match.d.ts +5 -36
- package/dist/search/match.d.ts.map +1 -1
- package/dist/search/match.js +2 -379
- package/dist/search/match.js.map +1 -1
- package/dist/search/reverse-index-build.d.ts +30 -0
- package/dist/search/reverse-index-build.d.ts.map +1 -0
- package/dist/search/reverse-index-build.js +72 -0
- package/dist/search/reverse-index-build.js.map +1 -0
- package/dist/search/reverse-index-format.d.ts +60 -0
- package/dist/search/reverse-index-format.d.ts.map +1 -0
- package/dist/search/reverse-index-format.js +54 -0
- package/dist/search/reverse-index-format.js.map +1 -0
- package/dist/search/reverse-index-groups.d.ts +37 -0
- package/dist/search/reverse-index-groups.d.ts.map +1 -0
- package/dist/search/reverse-index-groups.js +71 -0
- package/dist/search/reverse-index-groups.js.map +1 -0
- package/dist/search/reverse-index-passes.d.ts +78 -0
- package/dist/search/reverse-index-passes.d.ts.map +1 -0
- package/dist/search/reverse-index-passes.js +59 -0
- package/dist/search/reverse-index-passes.js.map +1 -0
- package/dist/search/reverse-index-state.d.ts +36 -0
- package/dist/search/reverse-index-state.d.ts.map +1 -0
- package/dist/search/reverse-index-state.js +95 -0
- package/dist/search/reverse-index-state.js.map +1 -0
- package/dist/search/reverse-index.d.ts +8 -67
- package/dist/search/reverse-index.d.ts.map +1 -1
- package/dist/search/reverse-index.js +4 -255
- package/dist/search/reverse-index.js.map +1 -1
- package/dist/sources/unihan-readings.d.ts +58 -0
- package/dist/sources/unihan-readings.d.ts.map +1 -0
- package/dist/sources/unihan-readings.js +95 -0
- package/dist/sources/unihan-readings.js.map +1 -0
- package/dist/sources/unihan.d.ts +6 -9
- package/dist/sources/unihan.d.ts.map +1 -1
- package/dist/sources/unihan.js +2 -85
- package/dist/sources/unihan.js.map +1 -1
- package/dist/syllable/final-tables.d.ts +23 -0
- package/dist/syllable/final-tables.d.ts.map +1 -0
- package/dist/syllable/final-tables.js +50 -0
- package/dist/syllable/final-tables.js.map +1 -0
- package/dist/syllable/inventory.d.ts +8 -42
- package/dist/syllable/inventory.d.ts.map +1 -1
- package/dist/syllable/inventory.js +9 -918
- package/dist/syllable/inventory.js.map +1 -1
- package/dist/syllable/spellings.d.ts +40 -0
- package/dist/syllable/spellings.d.ts.map +1 -0
- package/dist/syllable/spellings.js +469 -0
- package/dist/syllable/spellings.js.map +1 -0
- package/dist/syllable/syllable-parts.d.ts +31 -0
- package/dist/syllable/syllable-parts.d.ts.map +1 -0
- package/dist/syllable/syllable-parts.js +105 -0
- package/dist/syllable/syllable-parts.js.map +1 -0
- package/dist/syllable/syllable.d.ts +1 -14
- package/dist/syllable/syllable.d.ts.map +1 -1
- package/dist/syllable/syllable.js +3 -144
- package/dist/syllable/syllable.js.map +1 -1
- package/dist/syllable/written-tones.d.ts +6 -0
- package/dist/syllable/written-tones.d.ts.map +1 -0
- package/dist/syllable/written-tones.js +453 -0
- package/dist/syllable/written-tones.js.map +1 -0
- package/dist/transcription/bopomofo-parse.d.ts +42 -0
- package/dist/transcription/bopomofo-parse.d.ts.map +1 -0
- package/dist/transcription/bopomofo-parse.js +92 -0
- package/dist/transcription/bopomofo-parse.js.map +1 -0
- package/dist/transcription/bopomofo-reverse.d.ts +31 -0
- package/dist/transcription/bopomofo-reverse.d.ts.map +1 -0
- package/dist/transcription/bopomofo-reverse.js +48 -0
- package/dist/transcription/bopomofo-reverse.js.map +1 -0
- package/dist/transcription/bopomofo-symbols.d.ts +36 -0
- package/dist/transcription/bopomofo-symbols.d.ts.map +1 -0
- package/dist/transcription/bopomofo-symbols.js +41 -0
- package/dist/transcription/bopomofo-symbols.js.map +1 -0
- package/dist/transcription/bopomofo-tables.d.ts +87 -0
- package/dist/transcription/bopomofo-tables.d.ts.map +1 -0
- package/dist/transcription/bopomofo-tables.js +180 -0
- package/dist/transcription/bopomofo-tables.js.map +1 -0
- package/dist/transcription/bopomofo.d.ts +14 -32
- package/dist/transcription/bopomofo.d.ts.map +1 -1
- package/dist/transcription/bopomofo.js +5 -343
- package/dist/transcription/bopomofo.js.map +1 -1
- package/dist/transcription/gwoyeu-first-second.d.ts +36 -0
- package/dist/transcription/gwoyeu-first-second.d.ts.map +1 -0
- package/dist/transcription/gwoyeu-first-second.js +75 -0
- package/dist/transcription/gwoyeu-first-second.js.map +1 -0
- package/dist/transcription/gwoyeu-spelling.d.ts +38 -0
- package/dist/transcription/gwoyeu-spelling.d.ts.map +1 -0
- package/dist/transcription/gwoyeu-spelling.js +124 -0
- package/dist/transcription/gwoyeu-spelling.js.map +1 -0
- package/dist/transcription/gwoyeu-tables.d.ts +93 -0
- package/dist/transcription/gwoyeu-tables.d.ts.map +1 -0
- package/dist/transcription/gwoyeu-tables.js +205 -0
- package/dist/transcription/gwoyeu-tables.js.map +1 -0
- package/dist/transcription/gwoyeu-tonal-forms.d.ts +49 -0
- package/dist/transcription/gwoyeu-tonal-forms.d.ts.map +1 -0
- package/dist/transcription/gwoyeu-tonal-forms.js +89 -0
- package/dist/transcription/gwoyeu-tonal-forms.js.map +1 -0
- package/dist/transcription/gwoyeu-vowels.d.ts +51 -0
- package/dist/transcription/gwoyeu-vowels.d.ts.map +1 -0
- package/dist/transcription/gwoyeu-vowels.js +58 -0
- package/dist/transcription/gwoyeu-vowels.js.map +1 -0
- package/dist/transcription/gwoyeu.d.ts +1 -26
- package/dist/transcription/gwoyeu.d.ts.map +1 -1
- package/dist/transcription/gwoyeu.js +2 -540
- package/dist/transcription/gwoyeu.js.map +1 -1
- package/dist/transcription/ipa-symbols.d.ts +67 -0
- package/dist/transcription/ipa-symbols.d.ts.map +1 -0
- package/dist/transcription/ipa-symbols.js +135 -0
- package/dist/transcription/ipa-symbols.js.map +1 -0
- package/dist/transcription/ipa.d.ts +2 -10
- package/dist/transcription/ipa.d.ts.map +1 -1
- package/dist/transcription/ipa.js +2 -134
- package/dist/transcription/ipa.js.map +1 -1
- package/dist/transcription/wade-giles-index.d.ts +35 -0
- package/dist/transcription/wade-giles-index.d.ts.map +1 -0
- package/dist/transcription/wade-giles-index.js +110 -0
- package/dist/transcription/wade-giles-index.js.map +1 -0
- package/dist/transcription/wade-giles-parse.d.ts +36 -0
- package/dist/transcription/wade-giles-parse.d.ts.map +1 -0
- package/dist/transcription/wade-giles-parse.js +84 -0
- package/dist/transcription/wade-giles-parse.js.map +1 -0
- package/dist/transcription/wade-giles-spelling.d.ts +61 -0
- package/dist/transcription/wade-giles-spelling.d.ts.map +1 -0
- package/dist/transcription/wade-giles-spelling.js +107 -0
- package/dist/transcription/wade-giles-spelling.js.map +1 -0
- package/dist/transcription/wade-giles-syllable.d.ts +29 -0
- package/dist/transcription/wade-giles-syllable.d.ts.map +1 -0
- package/dist/transcription/wade-giles-syllable.js +90 -0
- package/dist/transcription/wade-giles-syllable.js.map +1 -0
- package/dist/transcription/wade-giles-tables.d.ts +80 -0
- package/dist/transcription/wade-giles-tables.d.ts.map +1 -0
- package/dist/transcription/wade-giles-tables.js +178 -0
- package/dist/transcription/wade-giles-tables.js.map +1 -0
- package/dist/transcription/wade-giles.d.ts +9 -60
- package/dist/transcription/wade-giles.d.ts.map +1 -1
- package/dist/transcription/wade-giles.js +6 -543
- package/dist/transcription/wade-giles.js.map +1 -1
- package/dist/transcription/yale-tables.d.ts +54 -0
- package/dist/transcription/yale-tables.d.ts.map +1 -0
- package/dist/transcription/yale-tables.js +125 -0
- package/dist/transcription/yale-tables.js.map +1 -0
- package/dist/transcription/yale.d.ts.map +1 -1
- package/dist/transcription/yale.js +1 -124
- package/dist/transcription/yale.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type EdgeRule } from "./rules.js";
|
|
2
|
+
/**
|
|
3
|
+
* 得 read as `děi` where it is a modal rather than a particle.
|
|
4
|
+
*
|
|
5
|
+
* One character, three readings, and the dictionary can only carry a default:
|
|
6
|
+
* 得 is stored `de` — the structural particle, which is far the commonest — with
|
|
7
|
+
* `dé` and `děi` as alternates. Nothing in the cost model can prefer an
|
|
8
|
+
* alternate at a position no word covers, so 我得走了 came out `wǒ de zǒule`
|
|
9
|
+
* and every other modal 得 with it. This is the case ROADMAP.md was waiting for
|
|
10
|
+
* before building stage 4: neither harness could see it, since the gold corpus
|
|
11
|
+
* had only 觉得 and CPP's 40 得 cases are labelled `dé` or `de` and never `děi`.
|
|
12
|
+
*
|
|
13
|
+
* The context is what separates the three, and only one side of it carries
|
|
14
|
+
* information. The particle 得 always follows the verb or adjective it attaches
|
|
15
|
+
* to (说得好, 跑得快, 累得要命), so a 得 with a *pronoun, adverb or time word*
|
|
16
|
+
* in front of it is not that particle. Requiring a verb phrase after it as well
|
|
17
|
+
* keeps 得了感冒 and 得了奖 — `dé`, and a real reading of the same character —
|
|
18
|
+
* out of it.
|
|
19
|
+
*
|
|
20
|
+
* Conditioning on what precedes rather than on what follows was measured, not
|
|
21
|
+
* assumed: "the word before is not a verb" fires 309 times over 88,866 lines of
|
|
22
|
+
* Tatoeba and zh.wikipedia and is wrong about four times in five, because
|
|
23
|
+
* jieba tags 下 as `f`, 学 as `n` and 飞 as nothing at all, and 雨下得很大 is a
|
|
24
|
+
* particle whatever the tag says. Naming the small closed set of things that
|
|
25
|
+
* can precede a modal is the same rule from the other side, and over the same
|
|
26
|
+
* text it fires 126 times and is right 122: the four misses are literary 得
|
|
27
|
+
* read `dé` after an adverb — 未必得喜悦, 暂得于己, 仅得约, 未得迁还家乡 —
|
|
28
|
+
* which nothing short of semantics separates from 必须得承认.
|
|
29
|
+
*/
|
|
30
|
+
export declare const MODAL_DE: EdgeRule;
|
|
31
|
+
/**
|
|
32
|
+
* A word beginning with 的 does not start where the particle 的 does.
|
|
33
|
+
*
|
|
34
|
+
* The structural particle attaches to the modifier in front of it and the head
|
|
35
|
+
* follows, so a dictionary key spanning that 的 and the head's first character
|
|
36
|
+
* is describing some other sentence: 没有人知道他的真名字 came out
|
|
37
|
+
* `tā dí zhēn míngzi` on the strength of 的真, 图书馆的卡 on 的卡, and 你說的對
|
|
38
|
+
* came out as one word, `deduì`.
|
|
39
|
+
*
|
|
40
|
+
* Only a key **no source has tagged** is forbidden, which is the same line
|
|
41
|
+
* {@link TEACHING_JIAO} draws for a word ending in 教. 的确, 的士 and 的哥 are
|
|
42
|
+
* words jieba counted and tagged, and every one of them can genuinely begin
|
|
43
|
+
* where this fires: 我的确知道, 我要一辆的士, 那个的哥. That leaves 我的哥哥们
|
|
44
|
+
* reading `wǒ dī gēgē men`, since 的哥 is a taxi driver and jieba has counted
|
|
45
|
+
* them. What this does reach is the untagged tail — a reading somebody asserted
|
|
46
|
+
* rather than a word anybody counted — where the 的 is the particle every time.
|
|
47
|
+
*
|
|
48
|
+
* Measured over the 88,866 lines of Tatoeba and zh.wikipedia it forbids edges
|
|
49
|
+
* in 40 runs: 的筆 13, 的這 11, 的真 6, 的對 4, 的卡 4 and 的歷 once. Every one
|
|
50
|
+
* is a correction, and half of them are corrections to the spacing as much as
|
|
51
|
+
* to the reading — 你說的對 was one word `deduì` and is now two.
|
|
52
|
+
*/
|
|
53
|
+
export declare const PARTICLE_DE: EdgeRule;
|
|
54
|
+
//# sourceMappingURL=de-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"de-rule.d.ts","sourceRoot":"","sources":["../../src/decode/de-rule.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,QAAQ,EAId,MAAM,YAAY,CAAC;AAgCpB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,QAAQ,EAAE,QActB,CAAC;AAWF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,EAAE,QAczB,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { tagOf, wordEndingAt, wordStartingAt, } from "./rules.js";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a syllable is `děi`, the modal reading of 得.
|
|
4
|
+
*
|
|
5
|
+
* Compared structurally rather than by spelling it out, since a syllable is
|
|
6
|
+
* stored as its parts and writing one back is the formatting stage's job.
|
|
7
|
+
*/
|
|
8
|
+
function isDei(syllable) {
|
|
9
|
+
return (syllable?.initial === "d" && syllable.final === "ei" && syllable.tone === 3);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* What stands in front of a modal 得: a subject, an adverb, or a time word.
|
|
13
|
+
*
|
|
14
|
+
* 我得走, 你就得去, 我今天得走. The particle 得 cannot follow any of these,
|
|
15
|
+
* because it attaches to the predicate it modifies — which is exactly what
|
|
16
|
+
* makes this the discriminating side of the context.
|
|
17
|
+
*/
|
|
18
|
+
const SUBJECT_TAGS = new Set(["r", "d", "t"]);
|
|
19
|
+
/**
|
|
20
|
+
* What follows a modal 得: the verb phrase it governs.
|
|
21
|
+
*
|
|
22
|
+
* Prepositions and adverbs are in because 我得在八月, 我得先走 and 我得快点 are
|
|
23
|
+
* all modal, and what follows the 得 in each is the front of a verb phrase
|
|
24
|
+
* rather than a verb.
|
|
25
|
+
*/
|
|
26
|
+
const GOVERNED_TAGS = /^(?:v|p|d|a)/u;
|
|
27
|
+
/**
|
|
28
|
+
* 得 read as `děi` where it is a modal rather than a particle.
|
|
29
|
+
*
|
|
30
|
+
* One character, three readings, and the dictionary can only carry a default:
|
|
31
|
+
* 得 is stored `de` — the structural particle, which is far the commonest — with
|
|
32
|
+
* `dé` and `děi` as alternates. Nothing in the cost model can prefer an
|
|
33
|
+
* alternate at a position no word covers, so 我得走了 came out `wǒ de zǒule`
|
|
34
|
+
* and every other modal 得 with it. This is the case ROADMAP.md was waiting for
|
|
35
|
+
* before building stage 4: neither harness could see it, since the gold corpus
|
|
36
|
+
* had only 觉得 and CPP's 40 得 cases are labelled `dé` or `de` and never `děi`.
|
|
37
|
+
*
|
|
38
|
+
* The context is what separates the three, and only one side of it carries
|
|
39
|
+
* information. The particle 得 always follows the verb or adjective it attaches
|
|
40
|
+
* to (说得好, 跑得快, 累得要命), so a 得 with a *pronoun, adverb or time word*
|
|
41
|
+
* in front of it is not that particle. Requiring a verb phrase after it as well
|
|
42
|
+
* keeps 得了感冒 and 得了奖 — `dé`, and a real reading of the same character —
|
|
43
|
+
* out of it.
|
|
44
|
+
*
|
|
45
|
+
* Conditioning on what precedes rather than on what follows was measured, not
|
|
46
|
+
* assumed: "the word before is not a verb" fires 309 times over 88,866 lines of
|
|
47
|
+
* Tatoeba and zh.wikipedia and is wrong about four times in five, because
|
|
48
|
+
* jieba tags 下 as `f`, 学 as `n` and 飞 as nothing at all, and 雨下得很大 is a
|
|
49
|
+
* particle whatever the tag says. Naming the small closed set of things that
|
|
50
|
+
* can precede a modal is the same rule from the other side, and over the same
|
|
51
|
+
* text it fires 126 times and is right 122: the four misses are literary 得
|
|
52
|
+
* read `dé` after an adverb — 未必得喜悦, 暂得于己, 仅得约, 未得迁还家乡 —
|
|
53
|
+
* which nothing short of semantics separates from 必须得承认.
|
|
54
|
+
*/
|
|
55
|
+
export const MODAL_DE = {
|
|
56
|
+
name: "modal-de",
|
|
57
|
+
verdictFor: (context) => {
|
|
58
|
+
const { edge } = context;
|
|
59
|
+
if (edge.text !== "得" || !isDei(edge.reading[0])) {
|
|
60
|
+
return "keep";
|
|
61
|
+
}
|
|
62
|
+
const before = wordEndingAt(context, edge.from);
|
|
63
|
+
const after = wordStartingAt(context, edge.to);
|
|
64
|
+
return SUBJECT_TAGS.has(tagOf(context, before)) &&
|
|
65
|
+
GOVERNED_TAGS.test(tagOf(context, after))
|
|
66
|
+
? "force"
|
|
67
|
+
: "keep";
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* The tags a word carries when the 的 after it is the structural particle.
|
|
72
|
+
*
|
|
73
|
+
* A pronoun, a noun, an adjective, a verb or a distinguishing word: 他的,
|
|
74
|
+
* 图书馆的, 伟大的, 见过面的, 男的. What the particle marks is a modifier, and
|
|
75
|
+
* these are what a modifier is.
|
|
76
|
+
*/
|
|
77
|
+
const MODIFIED_TAGS = /^(?:r|n|a|v|b|z)/u;
|
|
78
|
+
/**
|
|
79
|
+
* A word beginning with 的 does not start where the particle 的 does.
|
|
80
|
+
*
|
|
81
|
+
* The structural particle attaches to the modifier in front of it and the head
|
|
82
|
+
* follows, so a dictionary key spanning that 的 and the head's first character
|
|
83
|
+
* is describing some other sentence: 没有人知道他的真名字 came out
|
|
84
|
+
* `tā dí zhēn míngzi` on the strength of 的真, 图书馆的卡 on 的卡, and 你說的對
|
|
85
|
+
* came out as one word, `deduì`.
|
|
86
|
+
*
|
|
87
|
+
* Only a key **no source has tagged** is forbidden, which is the same line
|
|
88
|
+
* {@link TEACHING_JIAO} draws for a word ending in 教. 的确, 的士 and 的哥 are
|
|
89
|
+
* words jieba counted and tagged, and every one of them can genuinely begin
|
|
90
|
+
* where this fires: 我的确知道, 我要一辆的士, 那个的哥. That leaves 我的哥哥们
|
|
91
|
+
* reading `wǒ dī gēgē men`, since 的哥 is a taxi driver and jieba has counted
|
|
92
|
+
* them. What this does reach is the untagged tail — a reading somebody asserted
|
|
93
|
+
* rather than a word anybody counted — where the 的 is the particle every time.
|
|
94
|
+
*
|
|
95
|
+
* Measured over the 88,866 lines of Tatoeba and zh.wikipedia it forbids edges
|
|
96
|
+
* in 40 runs: 的筆 13, 的這 11, 的真 6, 的對 4, 的卡 4 and 的歷 once. Every one
|
|
97
|
+
* is a correction, and half of them are corrections to the spacing as much as
|
|
98
|
+
* to the reading — 你說的對 was one word `deduì` and is now two.
|
|
99
|
+
*/
|
|
100
|
+
export const PARTICLE_DE = {
|
|
101
|
+
name: "particle-de",
|
|
102
|
+
verdictFor: (context) => {
|
|
103
|
+
const { edge } = context;
|
|
104
|
+
if (edge.to - edge.from < 2 ||
|
|
105
|
+
edge.partOfSpeech !== "" ||
|
|
106
|
+
!edge.text.startsWith("的")) {
|
|
107
|
+
return "keep";
|
|
108
|
+
}
|
|
109
|
+
const before = wordEndingAt(context, edge.from);
|
|
110
|
+
return MODIFIED_TAGS.test(tagOf(context, before)) ? "forbid" : "keep";
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=de-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"de-rule.js","sourceRoot":"","sources":["../../src/decode/de-rule.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,EACL,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,SAAS,KAAK,CAAC,QAA8B;IAC3C,OAAO,CACL,QAAQ,EAAE,OAAO,KAAK,GAAG,IAAI,QAAQ,CAAC,KAAK,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,CAC5E,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,eAAe,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,IAAI,EAAE,UAAU;IAChB,UAAU,EAAE,CAAC,OAAoB,EAAE,EAAE;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACjD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/C,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC7C,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACzC,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,MAAM,CAAC;IACb,CAAC;CACF,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAa;IACnC,IAAI,EAAE,aAAa;IACnB,UAAU,EAAE,CAAC,OAAoB,EAAE,EAAE;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACzB,IACE,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC;YACvB,IAAI,CAAC,YAAY,KAAK,EAAE;YACxB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAC1B,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IACxE,CAAC;CACF,CAAC"}
|
package/dist/decode/decode.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Dictionary } from "../dictionary/dictionary.js";
|
|
2
|
-
import {
|
|
2
|
+
import type { ResolvedHints } from "./hints.js";
|
|
3
3
|
import { type Lattice } from "./lattice.js";
|
|
4
4
|
import { type ReadingProjection, type ReadingUnit } from "./locking.js";
|
|
5
|
-
import {
|
|
5
|
+
import type { EdgeRule } from "./rules.js";
|
|
6
6
|
import type { DecodedWord, ScoredWord } from "./word.js";
|
|
7
7
|
/**
|
|
8
8
|
* Decode the run's readings, scoring only where the readings are still open.
|
|
@@ -22,19 +22,6 @@ export declare function decodeReadings(lattice: Lattice, projection: ReadingProj
|
|
|
22
22
|
* spacing question is still open.
|
|
23
23
|
*/
|
|
24
24
|
export declare function decodeSpacing(lattice: Lattice): readonly number[];
|
|
25
|
-
/**
|
|
26
|
-
* Decode a Han run with the lattice: the recommended path.
|
|
27
|
-
*
|
|
28
|
-
* Stages 1 to 3 of ALGORITHM.md end to end — build every candidate reading,
|
|
29
|
-
* lock the positions that cannot vary, score the rest — where the greedy
|
|
30
|
-
* baseline commits to the longest match at each position and never revisits it.
|
|
31
|
-
*
|
|
32
|
-
* `before` is 汉字 standing in front of the run that the decode should see and
|
|
33
|
-
* not report: the 汉字 a number written in digits would have been written with.
|
|
34
|
-
* A run is decoded on its own without it, and a run reached that way has no idea
|
|
35
|
-
* what preceded it — 个人 alone is the word `gèrén`, while the 两 of 2个人 makes
|
|
36
|
-
* 两个 the word and leaves 人 to itself.
|
|
37
|
-
*/
|
|
38
25
|
export declare function decodeRun(dictionary: Dictionary, run: string, rules?: readonly EdgeRule[], before?: string, hints?: ResolvedHints): readonly DecodedWord[];
|
|
39
26
|
/**
|
|
40
27
|
* Decode a Han run, keeping what each reading was chosen over.
|
|
@@ -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;
|
|
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"}
|
package/dist/decode/decode.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { toCharacters } from "../script/characters.js";
|
|
2
1
|
import { scoreReadings } from "./confidence.js";
|
|
3
|
-
import {
|
|
4
|
-
import { allEdges, buildLattice, cutPoints } from "./lattice.js";
|
|
2
|
+
import { cutPoints } from "./lattice.js";
|
|
5
3
|
import { isSettled, projectReadings, settledUnits, unitsOf, } from "./locking.js";
|
|
6
4
|
import { READING_RULES } from "./reading-rules.js";
|
|
7
|
-
import { applyEdgeRules } from "./rules.js";
|
|
8
5
|
import { readingCost, shortestPath, spacingCost } from "./viterbi.js";
|
|
9
6
|
/**
|
|
10
7
|
* Decode the run's readings, scoring only where the readings are still open.
|
|
@@ -43,123 +40,7 @@ export function decodeReadings(lattice, projection) {
|
|
|
43
40
|
export function decodeSpacing(lattice) {
|
|
44
41
|
return shortestPath(lattice, 0, lattice.characters.length, spacingCost).map((edge) => edge.from);
|
|
45
42
|
}
|
|
46
|
-
|
|
47
|
-
* Gather the reading units into the words the boundaries make of them.
|
|
48
|
-
*
|
|
49
|
-
* Where the two decodes disagree the readings win, which is what "advisory"
|
|
50
|
-
* means for the spacing decode: a boundary falling inside a reading unit is
|
|
51
|
-
* dropped rather than allowed to break the unit up. 玩儿 read as `wánr` is one
|
|
52
|
-
* syllable over two characters, and no spacing can be put between them.
|
|
53
|
-
*/
|
|
54
|
-
function groupUnits(units, boundaries) {
|
|
55
|
-
const starts = new Set(units.map((unit) => unit.from));
|
|
56
|
-
const kept = new Set(boundaries.filter((at) => starts.has(at)));
|
|
57
|
-
const groups = [];
|
|
58
|
-
let held = [];
|
|
59
|
-
for (const unit of units) {
|
|
60
|
-
if (kept.has(unit.from) && held.length > 0) {
|
|
61
|
-
groups.push(held);
|
|
62
|
-
held = [];
|
|
63
|
-
}
|
|
64
|
-
held.push(unit);
|
|
65
|
-
}
|
|
66
|
-
if (held.length > 0) {
|
|
67
|
-
groups.push(held);
|
|
68
|
-
}
|
|
69
|
-
return groups;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Assemble one word from the units the boundaries kept together.
|
|
73
|
-
*/
|
|
74
|
-
function wordFrom(dictionary, lattice, group) {
|
|
75
|
-
const first = group[0];
|
|
76
|
-
const last = group.at(-1);
|
|
77
|
-
/* c8 ignore next 3 -- a group is only made by pushing a unit into it */
|
|
78
|
-
if (first === undefined || last === undefined) {
|
|
79
|
-
throw new Error("a word must cover at least one reading unit");
|
|
80
|
-
}
|
|
81
|
-
const text = lattice.characters.slice(first.from, last.to).join("");
|
|
82
|
-
const entry = dictionary.lookup(text);
|
|
83
|
-
return {
|
|
84
|
-
text,
|
|
85
|
-
reading: group.flatMap((unit) => [...unit.reading]),
|
|
86
|
-
isProperNoun: entry?.isProperNoun ?? false,
|
|
87
|
-
partOfSpeech: entry?.partOfSpeech ?? "",
|
|
88
|
-
isKnown: entry !== undefined,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* The lattice a run decodes over: stage 1 built, then stage 4 applied.
|
|
93
|
-
*
|
|
94
|
-
* The rules run between building and decoding rather than over the output,
|
|
95
|
-
* which is the whole point of them — they change what the decode gets to choose
|
|
96
|
-
* between, so everything downstream sees one lattice rather than a decode and
|
|
97
|
-
* a list of corrections to it.
|
|
98
|
-
*/
|
|
99
|
-
function ruledLattice(dictionary, run, rules, hints) {
|
|
100
|
-
return applyEdgeRules(buildLattice(dictionary, run, hints), dictionary, rules);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Whether any reading in the lattice would hold the two sides of a join
|
|
104
|
-
* together.
|
|
105
|
-
*
|
|
106
|
-
* A reading of one syllable per character can be cut anywhere; anything else —
|
|
107
|
-
* 儿化, a character with no reading — is a single claim about its whole span,
|
|
108
|
-
* so a claim spanning the join cannot be reported for the run alone. 1点儿事
|
|
109
|
-
* is that case: 一点儿 is one `yìdiǎnr` over the 一 the context supplied and
|
|
110
|
-
* the 点儿 the run did.
|
|
111
|
-
*/
|
|
112
|
-
function isJoinedAt(lattice, at) {
|
|
113
|
-
return allEdges(lattice).some((edge) => edge.from < at &&
|
|
114
|
-
edge.to > at &&
|
|
115
|
-
edge.reading.length !== edge.to - edge.from);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* The lattice a run decodes over, with whatever context stands in front of it.
|
|
119
|
-
*
|
|
120
|
-
* The context is dropped where a reading would hold it to the run, leaving the
|
|
121
|
-
* run decoded on its own, which is what it would have been before there was any
|
|
122
|
-
* context to give.
|
|
123
|
-
*/
|
|
124
|
-
function runLattice(dictionary, run, rules, before, hints) {
|
|
125
|
-
const alone = () => ({
|
|
126
|
-
lattice: ruledLattice(dictionary, run, rules, hints),
|
|
127
|
-
at: 0,
|
|
128
|
-
});
|
|
129
|
-
if (before === "") {
|
|
130
|
-
return alone();
|
|
131
|
-
}
|
|
132
|
-
const held = toCharacters(before).length;
|
|
133
|
-
// The context is decoded with the run, so every hint position moves along
|
|
134
|
-
// with it. Shifting a copy keeps the caller's positions relative to the run
|
|
135
|
-
// they were given for.
|
|
136
|
-
const lattice = ruledLattice(dictionary, before + run, rules, hints === undefined ? undefined : shiftHints(hints, held));
|
|
137
|
-
const at = held;
|
|
138
|
-
return isJoinedAt(lattice, at) ? alone() : { lattice, at };
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Cut a decode of the whole lattice down to the run at the end of it.
|
|
142
|
-
*
|
|
143
|
-
* Everything before `at` was context rather than run — 汉字 a caller put in
|
|
144
|
-
* front so that the decode could see them — and is dropped once it has done its
|
|
145
|
-
* work.
|
|
146
|
-
*/
|
|
147
|
-
function runGroups({ lattice, at }, units) {
|
|
148
|
-
return groupUnits(units.filter((unit) => unit.from >= at), decodeSpacing(lattice).filter((from) => from >= at));
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Decode a Han run with the lattice: the recommended path.
|
|
152
|
-
*
|
|
153
|
-
* Stages 1 to 3 of ALGORITHM.md end to end — build every candidate reading,
|
|
154
|
-
* lock the positions that cannot vary, score the rest — where the greedy
|
|
155
|
-
* baseline commits to the longest match at each position and never revisits it.
|
|
156
|
-
*
|
|
157
|
-
* `before` is 汉字 standing in front of the run that the decode should see and
|
|
158
|
-
* not report: the 汉字 a number written in digits would have been written with.
|
|
159
|
-
* A run is decoded on its own without it, and a run reached that way has no idea
|
|
160
|
-
* what preceded it — 个人 alone is the word `gèrén`, while the 两 of 2个人 makes
|
|
161
|
-
* 两个 the word and leaves 人 to itself.
|
|
162
|
-
*/
|
|
43
|
+
import { runGroups, runLattice, wordFrom } from "./run-lattice.js";
|
|
163
44
|
export function decodeRun(dictionary, run, rules = READING_RULES, before = "", hints) {
|
|
164
45
|
const held = runLattice(dictionary, run, rules, before, hints);
|
|
165
46
|
const { lattice } = held;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.js","sourceRoot":"","sources":["../../src/decode/decode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
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,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;AAED,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnE,MAAM,UAAU,SAAS,CACvB,UAAsB,EACtB,GAAW,EACX,KAAK,GAAwB,aAAa,EAC1C,MAAM,GAAG,EAAE,EACX,KAAqB;IAErB,MAAM,IAAI,GAAG,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACzB,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAChE,OAAO,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC1C,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CACrC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAsB,EACtB,GAAW,EACX,KAAK,GAAwB,aAAa,EAC1C,MAAM,GAAG,EAAE,EACX,KAAqB;IAErB,MAAM,IAAI,GAAG,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACzB,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAE/D,OAAO,SAAS,CAAa,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACxD,IAAI,EAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC;QAC1C,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CACjC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;YACtB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC,CAAC,CACJ;KACF,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three decoders a conversion can be run with.
|
|
3
|
+
*
|
|
4
|
+
* Each takes a Han run and hands back words; only one of them has anything to
|
|
5
|
+
* say about how settled it was, so the other two are wrapped to report
|
|
6
|
+
* nothing rather than each caller having to allow for the difference.
|
|
7
|
+
*/
|
|
8
|
+
import type { Dictionary } from "../dictionary/dictionary.js";
|
|
9
|
+
import type { ResolvedHints } from "./hints.js";
|
|
10
|
+
import type { ScoredWord } from "./word.js";
|
|
11
|
+
/**
|
|
12
|
+
* How a Han run is turned into words, with whatever the decoder can say about
|
|
13
|
+
* how settled they were.
|
|
14
|
+
*/
|
|
15
|
+
export type Decode = (dictionary: Dictionary, run: string, before: string, hints: ResolvedHints | undefined) => readonly ScoredWord[];
|
|
16
|
+
/**
|
|
17
|
+
* The lattice decoder, reporting nothing about its own confidence.
|
|
18
|
+
*/
|
|
19
|
+
export declare const LATTICE: Decode;
|
|
20
|
+
/**
|
|
21
|
+
* The lattice decoder, with what each reading was chosen over.
|
|
22
|
+
*/
|
|
23
|
+
export declare const SCORED: Decode;
|
|
24
|
+
/**
|
|
25
|
+
* The greedy baseline, which has nothing to report either way.
|
|
26
|
+
*
|
|
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.
|
|
30
|
+
*/
|
|
31
|
+
export declare const GREEDY: Decode;
|
|
32
|
+
//# sourceMappingURL=decoders.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { decodeRun, decodeRunScored } from "./decode.js";
|
|
2
|
+
import { decodeGreedily } from "./greedy.js";
|
|
3
|
+
import { READING_RULES } from "./reading-rules.js";
|
|
4
|
+
/**
|
|
5
|
+
* A decoder that reports no confidence at all, which is every decoder but one.
|
|
6
|
+
*/
|
|
7
|
+
function unscored(decode) {
|
|
8
|
+
return (dictionary, run, before, hints) => decode(dictionary, run, before, hints).map((word) => ({
|
|
9
|
+
word,
|
|
10
|
+
confidence: [],
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The lattice decoder, reporting nothing about its own confidence.
|
|
15
|
+
*/
|
|
16
|
+
export const LATTICE = unscored((dictionary, run, before, hints) => decodeRun(dictionary, run, READING_RULES, before, hints));
|
|
17
|
+
/**
|
|
18
|
+
* The lattice decoder, with what each reading was chosen over.
|
|
19
|
+
*/
|
|
20
|
+
export const SCORED = (dictionary, run, before, hints) => decodeRunScored(dictionary, run, READING_RULES, before, hints);
|
|
21
|
+
/**
|
|
22
|
+
* The greedy baseline, which has nothing to report either way.
|
|
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.
|
|
27
|
+
*/
|
|
28
|
+
export const GREEDY = unscored(decodeGreedily);
|
|
29
|
+
//# sourceMappingURL=decoders.js.map
|
|
@@ -0,0 +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,CAAC,CAAC;QACpD,IAAI;QACJ,UAAU,EAAE,EAAE;KACf,CAAC,CAAC,CAAC;AACR,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW,QAAQ,CAAC,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CACzE,SAAS,CAAC,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,CACzD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAW,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAC/D,eAAe,CAAC,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAW,QAAQ,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a rule can ask about the words around an edge.
|
|
3
|
+
*
|
|
4
|
+
* The lookups every edge rule shares: which word ends here, which starts here,
|
|
5
|
+
* and what part of speech the dictionary gives it.
|
|
6
|
+
*/
|
|
7
|
+
import type { EdgeContext } from "./rules.js";
|
|
8
|
+
/**
|
|
9
|
+
* The word ending at a position, longest first, or undefined.
|
|
10
|
+
*
|
|
11
|
+
* What a rule needs when it asks about the word *before* an edge. The decode
|
|
12
|
+
* has not run yet, so there is no settled answer; the longest dictionary word
|
|
13
|
+
* ending here is the closest thing available, and it is what the decode will
|
|
14
|
+
* usually choose, since the reading charge prefers fewer words.
|
|
15
|
+
*/
|
|
16
|
+
export declare function wordEndingAt(context: EdgeContext, at: number, longest?: number): string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The word starting at a position, longest first, or undefined.
|
|
19
|
+
*/
|
|
20
|
+
export declare function wordStartingAt(context: EdgeContext, at: number, longest?: number): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The part of speech the dictionary gives a word, or the empty string.
|
|
23
|
+
*/
|
|
24
|
+
export declare function tagOf(context: EdgeContext, word: string | undefined): string;
|
|
25
|
+
/**
|
|
26
|
+
* What follows a 教 that is teaching where no object does: aspect and the
|
|
27
|
+
* complement marker, which only a verb takes.
|
|
28
|
+
*
|
|
29
|
+
* 他教了三年书, 他教过我英语, 她教书教得很快乐. Matched as characters rather
|
|
30
|
+
* than through their tags, because what the dictionary has starting at a 得 is
|
|
31
|
+
* as likely to be 得很 as the particle itself.
|
|
32
|
+
*/
|
|
33
|
+
export declare const ASPECT: Set<string>;
|
|
34
|
+
/**
|
|
35
|
+
* The tag prefix jieba gives a particle, which nothing teaching can follow.
|
|
36
|
+
*/
|
|
37
|
+
export declare const PARTICLE_TAG = "u";
|
|
38
|
+
//# sourceMappingURL=edge-context.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The word ending at a position, longest first, or undefined.
|
|
3
|
+
*
|
|
4
|
+
* What a rule needs when it asks about the word *before* an edge. The decode
|
|
5
|
+
* has not run yet, so there is no settled answer; the longest dictionary word
|
|
6
|
+
* ending here is the closest thing available, and it is what the decode will
|
|
7
|
+
* usually choose, since the reading charge prefers fewer words.
|
|
8
|
+
*/
|
|
9
|
+
export function wordEndingAt(context, at, longest = 4) {
|
|
10
|
+
for (let length = longest; length > 0; length--) {
|
|
11
|
+
const from = at - length;
|
|
12
|
+
if (from < 0) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const text = context.characters.slice(from, at).join("");
|
|
16
|
+
if (context.dictionary.lookup(text) !== undefined) {
|
|
17
|
+
return text;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The word starting at a position, longest first, or undefined.
|
|
24
|
+
*/
|
|
25
|
+
export function wordStartingAt(context, at, longest = 4) {
|
|
26
|
+
for (let length = longest; length > 0; length--) {
|
|
27
|
+
// Nothing starts at the end of a run, which is where a 得 closing a
|
|
28
|
+
// sentence asks from.
|
|
29
|
+
const text = context.characters.slice(at, at + length).join("");
|
|
30
|
+
if (text !== "" && context.dictionary.lookup(text) !== undefined) {
|
|
31
|
+
return text;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The part of speech the dictionary gives a word, or the empty string.
|
|
38
|
+
*/
|
|
39
|
+
export function tagOf(context, word) {
|
|
40
|
+
return word === undefined
|
|
41
|
+
? ""
|
|
42
|
+
: (context.dictionary.lookup(word)?.partOfSpeech ?? "");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What follows a 教 that is teaching where no object does: aspect and the
|
|
46
|
+
* complement marker, which only a verb takes.
|
|
47
|
+
*
|
|
48
|
+
* 他教了三年书, 他教过我英语, 她教书教得很快乐. Matched as characters rather
|
|
49
|
+
* than through their tags, because what the dictionary has starting at a 得 is
|
|
50
|
+
* as likely to be 得很 as the particle itself.
|
|
51
|
+
*/
|
|
52
|
+
export const ASPECT = new Set(["了", "过", "過", "着", "著", "得"]);
|
|
53
|
+
/**
|
|
54
|
+
* The tag prefix jieba gives a particle, which nothing teaching can follow.
|
|
55
|
+
*/
|
|
56
|
+
export const PARTICLE_TAG = "u";
|
|
57
|
+
//# sourceMappingURL=edge-context.js.map
|
|
@@ -0,0 +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,EAAE,CAAC,CAAC;QAChE,IAAI,IAAI,KAAK,EAAE,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACjE,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,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,45 @@
|
|
|
1
|
+
import { type Lattice } from "./lattice.js";
|
|
2
|
+
import type { ResolvedHints } from "./hints.js";
|
|
3
|
+
/**
|
|
4
|
+
* The same hints with every position moved along by an offset.
|
|
5
|
+
*
|
|
6
|
+
* Word hints match on what is written and so are carried over untouched; only
|
|
7
|
+
* the positional ones are counted from somewhere. Used where a run is decoded
|
|
8
|
+
* with context in front of it, which moves the run's own characters up the
|
|
9
|
+
* lattice by the length of that context.
|
|
10
|
+
*/
|
|
11
|
+
export declare function shiftHints(hints: ResolvedHints, by: number): ResolvedHints;
|
|
12
|
+
/**
|
|
13
|
+
* The hints that fall inside a run, with their positions made relative to it.
|
|
14
|
+
*
|
|
15
|
+
* A caller counts positions from the start of the whole text, while a run is
|
|
16
|
+
* decoded on its own, so the positions have to be moved to where the run put
|
|
17
|
+
* them — and the ones naming a character in some other run dropped, rather than
|
|
18
|
+
* landing on whatever happens to sit at that index here.
|
|
19
|
+
*/
|
|
20
|
+
export declare function hintsWithin(hints: ResolvedHints, from: number, length: number): ResolvedHints;
|
|
21
|
+
/**
|
|
22
|
+
* A caller's readings, put into a lattice that was built without them.
|
|
23
|
+
*
|
|
24
|
+
* Two kinds of hint with deliberately different reach, which is the whole of
|
|
25
|
+
* the semantics:
|
|
26
|
+
*
|
|
27
|
+
* A **word** hint is an assertion about the text it names, so it rewrites the
|
|
28
|
+
* edge spanning exactly those characters and supplies the single-character
|
|
29
|
+
* edges underneath it. It says nothing about a *longer* word that happens to
|
|
30
|
+
* contain it — a bare 长 hint leaves 校长 as `xiàozhǎng`, because the dictionary
|
|
31
|
+
* knowing 校长 is better evidence about that stretch than a caller's remark
|
|
32
|
+
* about one of its characters. That is what makes a corrections table safe to
|
|
33
|
+
* accumulate: entries do not reach into words nobody was thinking about.
|
|
34
|
+
*
|
|
35
|
+
* A **positional** hint is an assertion about one character of one text, and it
|
|
36
|
+
* is the escape hatch precisely because nothing outranks it: it rewrites every
|
|
37
|
+
* edge covering that position, the enclosing word included. Only a reading of
|
|
38
|
+
* one syllable per character can be rewritten this way; a 儿化 edge is a single
|
|
39
|
+
* claim about its whole span and there is no one syllable in it to replace.
|
|
40
|
+
*
|
|
41
|
+
* Nothing is invented that a caller did not write, and nothing is dropped: an
|
|
42
|
+
* edge whose reading no hint touches comes through as it was.
|
|
43
|
+
*/
|
|
44
|
+
export declare function applyHints(lattice: Lattice, hints: ResolvedHints): Lattice;
|
|
45
|
+
//# sourceMappingURL=hint-lattice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hint-lattice.d.ts","sourceRoot":"","sources":["../../src/decode/hint-lattice.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,OAAO,EAAoC,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,YAAY,CAAC;AAiB1D;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,GAAG,aAAa,CAK1E;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,aAAa,CAQf;AAeD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAyF1E"}
|