@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
|
@@ -1,74 +1,10 @@
|
|
|
1
1
|
import { QUANTITY_CHARACTERS } from "../numerals/characters.js";
|
|
2
|
+
import { MODAL_DE, PARTICLE_DE } from "./de-rule.js";
|
|
3
|
+
import { TEACHING_JIAO } from "./jiao-rule.js";
|
|
4
|
+
export { MODAL_DE, PARTICLE_DE } from "./de-rule.js";
|
|
5
|
+
export { TEACHING_JIAO } from "./jiao-rule.js";
|
|
2
6
|
import { toCharacters } from "../script/characters.js";
|
|
3
|
-
import { tagOf, wordEndingAt,
|
|
4
|
-
/**
|
|
5
|
-
* Whether a syllable is `děi`, the modal reading of 得.
|
|
6
|
-
*
|
|
7
|
-
* Compared structurally rather than by spelling it out, since a syllable is
|
|
8
|
-
* stored as its parts and writing one back is the formatting stage's job.
|
|
9
|
-
*/
|
|
10
|
-
function isDei(syllable) {
|
|
11
|
-
return (syllable?.initial === "d" && syllable.final === "ei" && syllable.tone === 3);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* What stands in front of a modal 得: a subject, an adverb, or a time word.
|
|
15
|
-
*
|
|
16
|
-
* 我得走, 你就得去, 我今天得走. The particle 得 cannot follow any of these,
|
|
17
|
-
* because it attaches to the predicate it modifies — which is exactly what
|
|
18
|
-
* makes this the discriminating side of the context.
|
|
19
|
-
*/
|
|
20
|
-
const SUBJECT_TAGS = new Set(["r", "d", "t"]);
|
|
21
|
-
/**
|
|
22
|
-
* What follows a modal 得: the verb phrase it governs.
|
|
23
|
-
*
|
|
24
|
-
* Prepositions and adverbs are in because 我得在八月, 我得先走 and 我得快点 are
|
|
25
|
-
* all modal, and what follows the 得 in each is the front of a verb phrase
|
|
26
|
-
* rather than a verb.
|
|
27
|
-
*/
|
|
28
|
-
const GOVERNED_TAGS = /^(?:v|p|d|a)/u;
|
|
29
|
-
/**
|
|
30
|
-
* 得 read as `děi` where it is a modal rather than a particle.
|
|
31
|
-
*
|
|
32
|
-
* One character, three readings, and the dictionary can only carry a default:
|
|
33
|
-
* 得 is stored `de` — the structural particle, which is far the commonest — with
|
|
34
|
-
* `dé` and `děi` as alternates. Nothing in the cost model can prefer an
|
|
35
|
-
* alternate at a position no word covers, so 我得走了 came out `wǒ de zǒule`
|
|
36
|
-
* and every other modal 得 with it. This is the case ROADMAP.md was waiting for
|
|
37
|
-
* before building stage 4: neither harness could see it, since the gold corpus
|
|
38
|
-
* had only 觉得 and CPP's 40 得 cases are labelled `dé` or `de` and never `děi`.
|
|
39
|
-
*
|
|
40
|
-
* The context is what separates the three, and only one side of it carries
|
|
41
|
-
* information. The particle 得 always follows the verb or adjective it attaches
|
|
42
|
-
* to (说得好, 跑得快, 累得要命), so a 得 with a *pronoun, adverb or time word*
|
|
43
|
-
* in front of it is not that particle. Requiring a verb phrase after it as well
|
|
44
|
-
* keeps 得了感冒 and 得了奖 — `dé`, and a real reading of the same character —
|
|
45
|
-
* out of it.
|
|
46
|
-
*
|
|
47
|
-
* Conditioning on what precedes rather than on what follows was measured, not
|
|
48
|
-
* assumed: "the word before is not a verb" fires 309 times over 88,866 lines of
|
|
49
|
-
* Tatoeba and zh.wikipedia and is wrong about four times in five, because
|
|
50
|
-
* jieba tags 下 as `f`, 学 as `n` and 飞 as nothing at all, and 雨下得很大 is a
|
|
51
|
-
* particle whatever the tag says. Naming the small closed set of things that
|
|
52
|
-
* can precede a modal is the same rule from the other side, and over the same
|
|
53
|
-
* text it fires 126 times and is right 122: the four misses are literary 得
|
|
54
|
-
* read `dé` after an adverb — 未必得喜悦, 暂得于己, 仅得约, 未得迁还家乡 —
|
|
55
|
-
* which nothing short of semantics separates from 必须得承认.
|
|
56
|
-
*/
|
|
57
|
-
export const MODAL_DE = {
|
|
58
|
-
name: "modal-de",
|
|
59
|
-
verdictFor: (context) => {
|
|
60
|
-
const { edge } = context;
|
|
61
|
-
if (edge.text !== "得" || !isDei(edge.reading[0])) {
|
|
62
|
-
return "keep";
|
|
63
|
-
}
|
|
64
|
-
const before = wordEndingAt(context, edge.from);
|
|
65
|
-
const after = wordStartingAt(context, edge.to);
|
|
66
|
-
return SUBJECT_TAGS.has(tagOf(context, before)) &&
|
|
67
|
-
GOVERNED_TAGS.test(tagOf(context, after))
|
|
68
|
-
? "force"
|
|
69
|
-
: "keep";
|
|
70
|
-
},
|
|
71
|
-
};
|
|
7
|
+
import { tagOf, wordEndingAt, } from "./rules.js";
|
|
72
8
|
/**
|
|
73
9
|
* 儿 does not stand on its own where the dictionary attests the 儿化.
|
|
74
10
|
*
|
|
@@ -102,93 +38,6 @@ export const ATTESTED_ERHUA = {
|
|
|
102
38
|
return (reading?.at(-1)?.erhua ?? false) ? "forbid" : "keep";
|
|
103
39
|
},
|
|
104
40
|
};
|
|
105
|
-
/**
|
|
106
|
-
* Whether a syllable is `jiāo`, the verbal reading of 教.
|
|
107
|
-
*/
|
|
108
|
-
function isJiao(syllable) {
|
|
109
|
-
return (syllable?.initial === "j" && syllable.final === "iao" && syllable.tone === 1);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* What a 教 that is teaching governs: the thing or the person taught.
|
|
113
|
-
*
|
|
114
|
-
* A pronoun, a common noun, a name or one of the tags jieba gives a subject —
|
|
115
|
-
* 教我, 教英语, 教历史, 教孩子, 教玛丽. `ns` is deliberately absent, since the
|
|
116
|
-
* only 教 with a place tag after it over the corpus is 教青局, an office.
|
|
117
|
-
*/
|
|
118
|
-
const TAUGHT_TAGS = new Set(["r", "n", "nz", "nr", "nt", "ng"]);
|
|
119
|
-
/**
|
|
120
|
-
* What follows a 教 that is teaching where no object does: aspect and the
|
|
121
|
-
* complement marker, which only a verb takes.
|
|
122
|
-
*
|
|
123
|
-
* 他教了三年书, 他教过我英语, 她教书教得很快乐. Matched as characters rather
|
|
124
|
-
* than through their tags, because what the dictionary has starting at a 得 is
|
|
125
|
-
* as likely to be 得很 as the particle itself.
|
|
126
|
-
*/
|
|
127
|
-
const ASPECT = new Set(["了", "过", "過", "着", "著", "得"]);
|
|
128
|
-
/**
|
|
129
|
-
* The tag prefix jieba gives a particle, which nothing teaching can follow.
|
|
130
|
-
*/
|
|
131
|
-
const PARTICLE_TAG = "u";
|
|
132
|
-
/**
|
|
133
|
-
* Whether the 教 at a position is teaching something to somebody.
|
|
134
|
-
*
|
|
135
|
-
* The object is what says so, which is the same shape the modal 得 rule takes:
|
|
136
|
-
* a 教 with a pronoun, a noun or a name after it is governing it, and a 教 with
|
|
137
|
-
* 了, 过, 着 or 得 after it is a verb whatever follows that. A particle in front
|
|
138
|
-
* of it rules it out, since a verb does not follow one.
|
|
139
|
-
*/
|
|
140
|
-
function isTeachingAt(context, at) {
|
|
141
|
-
if (tagOf(context, wordEndingAt(context, at)).startsWith(PARTICLE_TAG)) {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
return (ASPECT.has(context.characters[at + 1] ?? "") ||
|
|
145
|
-
TAUGHT_TAGS.has(tagOf(context, wordStartingAt(context, at + 1))));
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* 教 read as `jiāo` where it is teaching rather than a religion.
|
|
149
|
-
*
|
|
150
|
-
* The dictionary stores 教 as `jiào` with `jiāo` as an alternate, and `jiào` is
|
|
151
|
-
* right for the compounds — 教育, 教师, 宗教, 主教 — which are words and reach
|
|
152
|
-
* their reading through the word. What is left is the 教 that stands as a word
|
|
153
|
-
* of its own, and that one is the verb: 他在北京大学教了三年书 came out
|
|
154
|
-
* `jiàole sān nián shū`, and 我教英语, 谁教你法语 and 她教我如何游泳 with it.
|
|
155
|
-
* 教书 is a word and was always `jiāo shū`; nothing carried that across a 了.
|
|
156
|
-
*
|
|
157
|
-
* See {@link isTeachingAt} for what decides it. Forcing the single-character
|
|
158
|
-
* edge is not enough on its own, because a reading spanning two characters
|
|
159
|
-
* carries its own 教 into the position: 王老师教我们汉语 read `jiào` off 师教,
|
|
160
|
-
* and 来教我 off 来教. Those are pairs the dictionary holds with no part of
|
|
161
|
-
* speech and at the cost of a word nothing has ever counted — a reading rather
|
|
162
|
-
* than a word — so a *tagged* word ending in 教 is left alone, which is every
|
|
163
|
-
* one that matters: 任教, 宗教, 主教, 佛教, 传教, 执教, 请教, 家教.
|
|
164
|
-
*
|
|
165
|
-
* Measured over 88,866 lines of Tatoeba and zh.wikipedia, 181 教 decode as a
|
|
166
|
-
* word of their own and every one of them read `jiào`. This moves 158 to
|
|
167
|
-
* `jiāo` and is wrong on three: 统一教创始人, 方法教深思 and 做到了教政分离,
|
|
168
|
-
* where a nominal compound takes an object's shape, the last of them because
|
|
169
|
-
* 做到了 is a word and so the 了 in front is not a particle to look at. Of the
|
|
170
|
-
* 21 it leaves, 8 are right — 诸教中, 教外别传, 董教总, 风教, 教青局 twice, a
|
|
171
|
-
* 教室 reached through a bad split, and a 教 used as a bare noun — and 13 are
|
|
172
|
-
* misses, where jieba tags the object something this does not name.
|
|
173
|
-
*/
|
|
174
|
-
export const TEACHING_JIAO = {
|
|
175
|
-
name: "teaching-jiao",
|
|
176
|
-
verdictFor: (context) => {
|
|
177
|
-
const { edge } = context;
|
|
178
|
-
if (edge.text === "教") {
|
|
179
|
-
return isJiao(edge.reading[0]) && isTeachingAt(context, edge.from)
|
|
180
|
-
? "force"
|
|
181
|
-
: "keep";
|
|
182
|
-
}
|
|
183
|
-
return edge.partOfSpeech === "" &&
|
|
184
|
-
edge.text.endsWith("教") &&
|
|
185
|
-
edge.reading.length === edge.to - edge.from &&
|
|
186
|
-
!isJiao(edge.reading.at(-1)) &&
|
|
187
|
-
isTeachingAt(context, edge.to - 1)
|
|
188
|
-
? "forbid"
|
|
189
|
-
: "keep";
|
|
190
|
-
},
|
|
191
|
-
};
|
|
192
41
|
/**
|
|
193
42
|
* The tag the dictionary gives a 量词.
|
|
194
43
|
*/
|
|
@@ -272,289 +121,14 @@ export const COUNTED_MEASURE = {
|
|
|
272
121
|
: "keep";
|
|
273
122
|
},
|
|
274
123
|
};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
*/
|
|
278
|
-
function isChang(syllable) {
|
|
279
|
-
return (syllable?.initial === "ch" &&
|
|
280
|
-
syllable.final === "ang" &&
|
|
281
|
-
syllable.tone === 2);
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Adverbs that measure a quality rather than modify an action.
|
|
285
|
-
*
|
|
286
|
-
* The discriminating side of the 长 context, and the reason the set is written
|
|
287
|
-
* out rather than taken from a tag: jieba calls 很 `zg` and 多 `m`, so the two
|
|
288
|
-
* commonest members are not adverbs as far as the dictionary is concerned,
|
|
289
|
-
* while 已经, 也, 却 and 就 — which sit in front of the *verb* 长 — are `d`
|
|
290
|
-
* along with the ones wanted here. The tag names the wrong set in both
|
|
291
|
-
* directions, so the set is named directly.
|
|
292
|
-
*
|
|
293
|
-
* Everything here is degree or comparison. 还 and 不 are deliberately absent
|
|
294
|
-
* even though 距离还长 and 那座桥不长 are both `cháng`: they modify verbs as
|
|
295
|
-
* readily as qualities, and 还长有毛 and 胡子不长在前额上 are the same two
|
|
296
|
-
* characters around the verb.
|
|
297
|
-
*/
|
|
298
|
-
const DEGREE = new Set([
|
|
299
|
-
"一样",
|
|
300
|
-
"十分",
|
|
301
|
-
"多",
|
|
302
|
-
"多么",
|
|
303
|
-
"好",
|
|
304
|
-
"如此",
|
|
305
|
-
"尽量",
|
|
306
|
-
"很",
|
|
307
|
-
"格外",
|
|
308
|
-
"极",
|
|
309
|
-
"极其",
|
|
310
|
-
"比较",
|
|
311
|
-
"略",
|
|
312
|
-
"相当",
|
|
313
|
-
"真",
|
|
314
|
-
"稍",
|
|
315
|
-
"稍微",
|
|
316
|
-
"越",
|
|
317
|
-
"越来越",
|
|
318
|
-
"这么",
|
|
319
|
-
"这样",
|
|
320
|
-
"那么",
|
|
321
|
-
"那样",
|
|
322
|
-
"更",
|
|
323
|
-
"最",
|
|
324
|
-
"有多",
|
|
325
|
-
"特别",
|
|
326
|
-
"老",
|
|
327
|
-
"够",
|
|
328
|
-
"挺",
|
|
329
|
-
"太",
|
|
330
|
-
"非常",
|
|
331
|
-
]);
|
|
332
|
-
/**
|
|
333
|
-
* What shows a 长 to be growing even with a degree word in front of it.
|
|
334
|
-
*
|
|
335
|
-
* {@link DEGREE} already excludes nearly everything that precedes the verb, so
|
|
336
|
-
* this only has to settle the three shapes reachable from both sets: 真长得很快
|
|
337
|
-
* and 越长得快, where 得 marks the complement; 长着, where the aspect does; and
|
|
338
|
-
* 越长越高, where the correlative makes the 长 the thing that increases.
|
|
339
|
-
*
|
|
340
|
-
* 了 and 的 are pointedly *not* here, and that is the whole use of conditioning
|
|
341
|
-
* on the adverb first. Following a bare 长 either would suggest the verb — 长了
|
|
342
|
-
* 一个大包, 长的很像 — but following an adverb and a 长 they are the sentence
|
|
343
|
-
* particle and the attributive: 时间太长了 and 很长的道路 are both `cháng`, and
|
|
344
|
-
* an earlier draft of this rule that guarded on them read both as `zhǎng`.
|
|
345
|
-
*/
|
|
346
|
-
const GROWING = new Set(["得", "着", "越"]);
|
|
347
|
-
/**
|
|
348
|
-
* What growing produces, as the far half of 越长越X.
|
|
349
|
-
*
|
|
350
|
-
* 越长越高, 越长越大, 越长越胖: each names a dimension that increases *because*
|
|
351
|
-
* something grew, so the 长 in front of it is the verb. The adjectives that go
|
|
352
|
-
* with a length or a duration are pointedly absent — 时间越长越好, 队伍越长越慢
|
|
353
|
-
* — because those are the cases the sources already read correctly.
|
|
354
|
-
*/
|
|
355
|
-
const GROWN_INTO = new Set(["高", "大", "胖", "壮", "结实"]);
|
|
356
|
-
/**
|
|
357
|
-
* Whether an edge is the 越长 of a 越长越X saying something grew.
|
|
358
|
-
*
|
|
359
|
-
* This exists because of a defect in the sources rather than a gap in them.
|
|
360
|
-
* 越长 is a key, read `yuè cháng`, and it is the *only* one of its shape: 越大,
|
|
361
|
-
* 越高, 越好, 越快 and 越多 are all absent, so 越高越好 decodes as two words and
|
|
362
|
-
* 越长越高 reaches for a word nothing else in the paradigm has. It carries no
|
|
363
|
-
* part of speech, which is how the dictionary holds a reading somebody asserted
|
|
364
|
-
* rather than a word anybody counted — the same category {@link TEACHING_JIAO}
|
|
365
|
-
* declines to trust — and it comes from one source, `large_pinyin.txt`, with
|
|
366
|
-
* CC-CEDICT holding no such entry.
|
|
367
|
-
*
|
|
368
|
-
* Taking the edge away leaves the character's own default, which is `zhǎng`,
|
|
369
|
-
* and leaves `cháng` standing as a rival about one bucket dearer. That last
|
|
370
|
-
* part is the point of forbidding rather than forcing: 越长越X is genuinely
|
|
371
|
-
* ambiguous — 孩子越长越漂亮 grows and 头发越长越漂亮 lengthens, and only the
|
|
372
|
-
* subject says which — so the decode should answer with the likelier reading
|
|
373
|
-
* and still report itself as guessing. A forced edge could not.
|
|
374
|
-
*
|
|
375
|
-
* Unlike the rest of this file the shape has no corpus behind it: 越长 occurs
|
|
376
|
-
* three times in the 88,866 lines, and all three are 越来越长 or 说的越长. The
|
|
377
|
-
* word list is therefore small on purpose, and everything outside it is left as
|
|
378
|
-
* the sources have it.
|
|
379
|
-
*/
|
|
380
|
-
function isGrowthCorrelative(context) {
|
|
381
|
-
const { characters, edge } = context;
|
|
382
|
-
return (edge.text === "越长" &&
|
|
383
|
-
edge.partOfSpeech === "" &&
|
|
384
|
-
characters[edge.to] === "越" &&
|
|
385
|
-
GROWN_INTO.has(characters[edge.to + 1] ?? ""));
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* 长 read as `cháng` where an adverb of degree measures it.
|
|
389
|
-
*
|
|
390
|
-
* The character is stored `zhǎng` with `cháng` as an alternate, and the data
|
|
391
|
-
* says so about the character in isolation: Unihan ranks the readings
|
|
392
|
-
* `zhǎng(1879) cháng(1179)` by corpus count and names `zhǎng` in `kMandarin`.
|
|
393
|
-
* That ranking is doing real work — 署长, 团长, 公安局长, 总会长, 审理长 and
|
|
394
|
-
* the rest reach a bare 长 at the end of a title and read it correctly — so the
|
|
395
|
-
* default is not the thing to change. What is left over is the 长 that is an
|
|
396
|
-
* adjective, and nothing in the cost model can prefer an alternate at a
|
|
397
|
-
* position no word covers: 这篇文章不太长 came out `bú tài zhǎng`.
|
|
398
|
-
*
|
|
399
|
-
* The context that separates them is one-sided, as it was for the modal 得. A
|
|
400
|
-
* 长 that is *growing* is a verb, and a degree adverb cannot modify one — there
|
|
401
|
-
* is no 很长 meaning it grew a lot — so 很, 太, 最, 多 and their kin in front of
|
|
402
|
-
* a bare 长 make it the adjective. The other side carries almost nothing: what
|
|
403
|
-
* follows an adjectival 长 is a noun (很长时间), a particle (最长的大桥), or the
|
|
404
|
-
* end of the sentence (他的腿很长), which is also what follows half the verbs.
|
|
405
|
-
*
|
|
406
|
-
* Measured over the same 88,866 lines of Tatoeba and zh.wikipedia the other
|
|
407
|
-
* rules were sized against, 260 长 decode as a word of their own and this moves
|
|
408
|
-
* 75 of them to `cháng`, all 75 correctly. On CPP's 40 hand-labelled 长 it takes
|
|
409
|
-
* the character from 85.00% to 87.50%, fixing 时间最长 and breaking nothing.
|
|
410
|
-
*
|
|
411
|
-
* The other half of the rule is {@link GROWN_INTO}, which pushes the opposite
|
|
412
|
-
* way on the one shape the sources get wrong.
|
|
413
|
-
*/
|
|
414
|
-
export const ADJECTIVAL_CHANG = {
|
|
415
|
-
name: "adjectival-chang",
|
|
416
|
-
verdictFor: (context) => {
|
|
417
|
-
const { characters, edge } = context;
|
|
418
|
-
if (isGrowthCorrelative(context)) {
|
|
419
|
-
return "forbid";
|
|
420
|
-
}
|
|
421
|
-
if (edge.text !== "长" || !isChang(edge.reading[0])) {
|
|
422
|
-
return "keep";
|
|
423
|
-
}
|
|
424
|
-
if (GROWING.has(characters[edge.to] ?? "")) {
|
|
425
|
-
return "keep";
|
|
426
|
-
}
|
|
427
|
-
const before = wordEndingAt(context, edge.from);
|
|
428
|
-
return before !== undefined && DEGREE.has(before) ? "force" : "keep";
|
|
429
|
-
},
|
|
430
|
-
};
|
|
431
|
-
/**
|
|
432
|
-
* Whether a syllable is `tán`, the verbal reading of 弹.
|
|
433
|
-
*/
|
|
434
|
-
function isTan(syllable) {
|
|
435
|
-
return (syllable?.initial === "t" && syllable.final === "an" && syllable.tone === 2);
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* The character in both scripts, since 彈 is not the shape 弹 is.
|
|
439
|
-
*
|
|
440
|
-
* 得, 教 and 儿 are the same character in either script and need say it once.
|
|
441
|
-
* This one is not, and neither is the 长 above, which is silent on 長 as a
|
|
442
|
-
* result. {@link ASPECT} carries 過 and 著 for the same reason this carries 彈.
|
|
443
|
-
*/
|
|
444
|
-
const PLUCKED = new Set(["弹", "彈"]);
|
|
445
|
-
/**
|
|
446
|
-
* Whether the character at a position is 弹, in either script.
|
|
447
|
-
*/
|
|
448
|
-
function isPluckedAt(context, at) {
|
|
449
|
-
return PLUCKED.has(context.characters[at] ?? "");
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* What a 弹 that is playing governs: the instrument, the piece or its composer.
|
|
453
|
-
*
|
|
454
|
-
* 弹吉他, 弹竖琴, 弹肖邦, 弹一曲, 给我们弹一手. The name tags are in because
|
|
455
|
-
* jieba calls 吉他 `ns` and 管风琴, 班卓琴 and 古琴 `nr` — instruments read as
|
|
456
|
-
* places and people — and `m` because a piece is as often counted as named.
|
|
457
|
-
*/
|
|
458
|
-
const PLAYED_TAGS = new Set(["n", "nz", "nr", "ns", "nt", "ng", "m"]);
|
|
459
|
-
/**
|
|
460
|
-
* Whether a word is an object rather than the far half of a compound.
|
|
461
|
-
*
|
|
462
|
-
* The one place this rule departs from {@link isTeachingAt}, and it is what
|
|
463
|
-
* makes it usable on technical prose. 弹 joins bound morphemes into nouns far
|
|
464
|
-
* more readily than 教 does — 着弹点, 掷弹兵, 供弹爪, 底排弹时, 弹洞 — and every
|
|
465
|
-
* one of those puts a single tagged character after the 弹 where an object
|
|
466
|
-
* would go. What the verb actually governs is a word: 吉他, 竖琴, 管风琴, 电子琴,
|
|
467
|
-
* 一曲, 肖邦. Requiring two characters keeps the compounds out at the cost of
|
|
468
|
-
* 反手持法去弹班卓琴, where the decode reaches 班 rather than 班卓琴 anyway.
|
|
469
|
-
*
|
|
470
|
-
* 教 could not take the same guard, since 教我 and 教你 are the commonest shape
|
|
471
|
-
* it has. Nobody plays a pronoun, so `r` is out of {@link PLAYED_TAGS} too.
|
|
472
|
-
*/
|
|
473
|
-
function isPlayedObject(word) {
|
|
474
|
-
return word !== undefined && toCharacters(word).length > 1;
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* Whether the 弹 at a position is playing something.
|
|
478
|
-
*
|
|
479
|
-
* Much the same shape as {@link isTeachingAt}, and for the same reason: the
|
|
480
|
-
* object is what says so. A 弹 with an instrument, a tune or a name after it is
|
|
481
|
-
* governing it, and a 弹 with 了, 过, 着 or 得 after it is a verb whatever
|
|
482
|
-
* follows that. A particle in front of it rules it out, since a verb does not
|
|
483
|
-
* follow one.
|
|
484
|
-
*/
|
|
485
|
-
function isPlayingAt(context, at) {
|
|
486
|
-
if (tagOf(context, wordEndingAt(context, at)).startsWith(PARTICLE_TAG)) {
|
|
487
|
-
return false;
|
|
488
|
-
}
|
|
489
|
-
if (ASPECT.has(context.characters[at + 1] ?? "")) {
|
|
490
|
-
return true;
|
|
491
|
-
}
|
|
492
|
-
const played = wordStartingAt(context, at + 1);
|
|
493
|
-
return isPlayedObject(played) && PLAYED_TAGS.has(tagOf(context, played));
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* 弹 read as `tán` where it is playing rather than a projectile.
|
|
497
|
-
*
|
|
498
|
-
* The character is stored `dàn` with `tán` as an alternate, and the sources are
|
|
499
|
-
* agreed about it: Unihan's `kHanyuPinlu` counts `dàn(313)` against `tán(50)`
|
|
500
|
-
* and `kMandarin` names `dàn`. That is a fact about a corpus in which nearly
|
|
501
|
-
* every 弹 is ammunition — 子弹, 炮弹, 导弹, 原子弹, 手榴弹 — and every one of
|
|
502
|
-
* those is a word that carries its own reading. What the default is left
|
|
503
|
-
* deciding is the 弹 that stands as a word of its own, and in running text that
|
|
504
|
-
* one is the verb: 他会弹一点儿古筝 came out `dàn`, and 弹吉他, 弹竖琴, 我在弹肖邦
|
|
505
|
-
* and 他钢琴弹得很好 with it.
|
|
506
|
-
*
|
|
507
|
-
* See {@link isPlayingAt} for what decides it. Forcing the single-character
|
|
508
|
-
* edge is not enough on its own, for the reason {@link TEACHING_JIAO} gives: a
|
|
509
|
-
* reading spanning two characters carries its own 弹 into the position, and
|
|
510
|
-
* 我的爱好是开车和弹吉他 read `dàn` off 和弹, a pair the dictionary holds with
|
|
511
|
-
* no part of speech and at the cost of a reading nobody counted. A *tagged*
|
|
512
|
-
* word ending in 弹 is left alone, which is every one that matters — 子弹, 炸弹,
|
|
513
|
-
* 导弹, 反弹, 手榴弹. Nothing has to be done about the other side, since the
|
|
514
|
-
* nominal compounds starting with 弹 are all listed: 弹匣, 弹坑, 弹壳, 弹片,
|
|
515
|
-
* 弹药, 弹道 and 弹头 reach their reading through the word, so a bare 弹 with a
|
|
516
|
-
* noun after it is not the front of one that got away.
|
|
517
|
-
*
|
|
518
|
-
* The 88,866 lines of Tatoeba and zh.wikipedia the other rules were sized
|
|
519
|
-
* against are the wrong corpus for this one on their own: 38 弹 decode as a
|
|
520
|
-
* word of their own in them, and 31 are somebody playing something. So CPP's
|
|
521
|
-
* 20,147 sentences are measured with them as plain text — the benchmark is
|
|
522
|
-
* drawn from zh.wikipedia's military articles, which is precisely where the
|
|
523
|
-
* shapes this rule can break live. Over the 109,013 lines together, 60 弹
|
|
524
|
-
* decode as a word of their own, every one read `dàn`, and 34 of the 60 are
|
|
525
|
-
* wrong.
|
|
526
|
-
*
|
|
527
|
-
* This moves 30 of them, of which 29 are right: the whole of 弹吉他, 弹一曲肖邦
|
|
528
|
-
* and 钢琴弹得很好, and none of 南部弹, 毛瑟弹, 掷弹兵, 供弹爪, 着弹点, 弹洞 or
|
|
529
|
-
* 底排弹时. The one it breaks is 拆弹专家, where a compound has an object's
|
|
530
|
-
* shape on both sides. Five it leaves alone: 开始弹, 四手联弹 and 弹起三次, which
|
|
531
|
-
* have no object to see, 用那种指法弹不会觉得费力, and 反手持法去弹班卓琴, where
|
|
532
|
-
* the decode reaches 班 rather than 班卓琴. On CPP's 40 labelled 弹 nothing
|
|
533
|
-
* moves at all, every one of them having been right through a word.
|
|
534
|
-
*/
|
|
535
|
-
export const PLAYING_TAN = {
|
|
536
|
-
name: "playing-tan",
|
|
537
|
-
verdictFor: (context) => {
|
|
538
|
-
const { edge } = context;
|
|
539
|
-
if (PLUCKED.has(edge.text)) {
|
|
540
|
-
return isTan(edge.reading[0]) && isPlayingAt(context, edge.from)
|
|
541
|
-
? "force"
|
|
542
|
-
: "keep";
|
|
543
|
-
}
|
|
544
|
-
return edge.partOfSpeech === "" &&
|
|
545
|
-
isPluckedAt(context, edge.to - 1) &&
|
|
546
|
-
edge.reading.length === edge.to - edge.from &&
|
|
547
|
-
!isTan(edge.reading.at(-1)) &&
|
|
548
|
-
isPlayingAt(context, edge.to - 1)
|
|
549
|
-
? "forbid"
|
|
550
|
-
: "keep";
|
|
551
|
-
},
|
|
552
|
-
};
|
|
124
|
+
import { ADJECTIVAL_CHANG, PLAYING_TAN } from "./polyphone-rules.js";
|
|
125
|
+
export { ADJECTIVAL_CHANG, PLAYING_TAN } from "./polyphone-rules.js";
|
|
553
126
|
/**
|
|
554
127
|
* The rules the lattice decode applies, in order.
|
|
555
128
|
*/
|
|
556
129
|
export const READING_RULES = [
|
|
557
130
|
MODAL_DE,
|
|
131
|
+
PARTICLE_DE,
|
|
558
132
|
TEACHING_JIAO,
|
|
559
133
|
ATTESTED_ERHUA,
|
|
560
134
|
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,
|
|
1
|
+
{"version":3,"file":"reading-rules.js","sourceRoot":"","sources":["../../src/decode/reading-rules.ts"],"names":[],"mappings":"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"}
|
package/dist/decode/rules.d.ts
CHANGED
|
@@ -1,5 +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
4
|
/**
|
|
4
5
|
* What a rule can say about one edge.
|
|
5
6
|
*
|
|
@@ -33,23 +34,6 @@ export interface EdgeRule {
|
|
|
33
34
|
readonly name: string;
|
|
34
35
|
readonly verdictFor: (context: EdgeContext) => EdgeVerdict;
|
|
35
36
|
}
|
|
36
|
-
/**
|
|
37
|
-
* The word ending at a position, longest first, or undefined.
|
|
38
|
-
*
|
|
39
|
-
* What a rule needs when it asks about the word *before* an edge. The decode
|
|
40
|
-
* has not run yet, so there is no settled answer; the longest dictionary word
|
|
41
|
-
* ending here is the closest thing available, and it is what the decode will
|
|
42
|
-
* usually choose, since the reading charge prefers fewer words.
|
|
43
|
-
*/
|
|
44
|
-
export declare function wordEndingAt(context: EdgeContext, at: number, longest?: number): string | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* The word starting at a position, longest first, or undefined.
|
|
47
|
-
*/
|
|
48
|
-
export declare function wordStartingAt(context: EdgeContext, at: number, longest?: number): string | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* The part of speech the dictionary gives a word, or the empty string.
|
|
51
|
-
*/
|
|
52
|
-
export declare function tagOf(context: EdgeContext, word: string | undefined): string;
|
|
53
37
|
/**
|
|
54
38
|
* Apply the rules to a lattice, returning the lattice they leave.
|
|
55
39
|
*
|
|
@@ -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;;;;;;;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,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,WAAW,CAAC;CAC5D;
|
|
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,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,WAAW,CAAC;CAC5D;AA+DD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,SAAS,QAAQ,EAAE,GACzB,OAAO,CAsCT"}
|
package/dist/decode/rules.js
CHANGED
|
@@ -1,46 +1,4 @@
|
|
|
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
|
-
}
|
|
1
|
+
export { ASPECT, PARTICLE_TAG, tagOf, wordEndingAt, wordStartingAt, } from "./edge-context.js";
|
|
44
2
|
/**
|
|
45
3
|
* Whether every position can still be left, and the end still reached.
|
|
46
4
|
*
|
package/dist/decode/rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/decode/rules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/decode/rules.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type Lattice } from "./lattice.js";
|
|
2
|
+
import type { ResolvedHints } from "./hints.js";
|
|
3
|
+
import type { RunLattice } from "./lattice-slice.js";
|
|
4
|
+
export { runLattice } from "./lattice-slice.js";
|
|
5
|
+
import type { Dictionary } from "../dictionary/dictionary.js";
|
|
6
|
+
import type { ReadingUnit } from "./locking.js";
|
|
7
|
+
import { type EdgeRule } from "./rules.js";
|
|
8
|
+
import type { DecodedWord } from "./word.js";
|
|
9
|
+
/**
|
|
10
|
+
* Gather the reading units into the words the boundaries make of them.
|
|
11
|
+
*
|
|
12
|
+
* Where the two decodes disagree the readings win, which is what "advisory"
|
|
13
|
+
* means for the spacing decode: a boundary falling inside a reading unit is
|
|
14
|
+
* dropped rather than allowed to break the unit up. 玩儿 read as `wánr` is one
|
|
15
|
+
* syllable over two characters, and no spacing can be put between them.
|
|
16
|
+
*/
|
|
17
|
+
export declare function groupUnits<Unit extends ReadingUnit>(units: readonly Unit[], boundaries: readonly number[]): readonly (readonly Unit[])[];
|
|
18
|
+
/**
|
|
19
|
+
* Assemble one word from the units the boundaries kept together.
|
|
20
|
+
*/
|
|
21
|
+
export declare function wordFrom(dictionary: Dictionary, lattice: Lattice, group: readonly ReadingUnit[]): DecodedWord;
|
|
22
|
+
/**
|
|
23
|
+
* The lattice a run decodes over: stage 1 built, then stage 4 applied.
|
|
24
|
+
*
|
|
25
|
+
* The rules run between building and decoding rather than over the output,
|
|
26
|
+
* which is the whole point of them — they change what the decode gets to choose
|
|
27
|
+
* between, so everything downstream sees one lattice rather than a decode and
|
|
28
|
+
* a list of corrections to it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function ruledLattice(dictionary: Dictionary, run: string, rules: readonly EdgeRule[], hints: ResolvedHints | undefined): Lattice;
|
|
31
|
+
/**
|
|
32
|
+
* Cut a decode of the whole lattice down to the run at the end of it.
|
|
33
|
+
*
|
|
34
|
+
* Everything before `at` was context rather than run — 汉字 a caller put in
|
|
35
|
+
* front so that the decode could see them — and is dropped once it has done its
|
|
36
|
+
* work.
|
|
37
|
+
*/
|
|
38
|
+
export declare function runGroups<Unit extends ReadingUnit>({ lattice, at }: RunLattice, units: readonly Unit[]): readonly (readonly Unit[])[];
|
|
39
|
+
/**
|
|
40
|
+
* Decode a Han run with the lattice: the recommended path.
|
|
41
|
+
*
|
|
42
|
+
* Stages 1 to 3 of ALGORITHM.md end to end — build every candidate reading,
|
|
43
|
+
* lock the positions that cannot vary, score the rest — where the greedy
|
|
44
|
+
* baseline commits to the longest match at each position and never revisits it.
|
|
45
|
+
*
|
|
46
|
+
* `before` is 汉字 standing in front of the run that the decode should see and
|
|
47
|
+
* not report: the 汉字 a number written in digits would have been written with.
|
|
48
|
+
* A run is decoded on its own without it, and a run reached that way has no idea
|
|
49
|
+
* what preceded it — 个人 alone is the word `gèrén`, while the 两 of 2个人 makes
|
|
50
|
+
* 两个 the word and leaves 人 to itself.
|
|
51
|
+
*/
|
|
52
|
+
//# sourceMappingURL=run-lattice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-lattice.d.ts","sourceRoot":"","sources":["../../src/decode/run-lattice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAShD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,SAAS,WAAW,EACjD,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,SAAS,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,CAkB9B;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS,WAAW,EAAE,GAC5B,WAAW,CAiBb;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,KAAK,EAAE,aAAa,GAAG,SAAS,GAC/B,OAAO,CAMT;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,SAAS,WAAW,EAChD,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,UAAU,EAC3B,KAAK,EAAE,SAAS,IAAI,EAAE,GACrB,SAAS,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,CAK9B;AAED;;;;;;;;;;;;GAYG"}
|