@kensio/pinyinjs 1.7.4 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/confidence.d.ts.map +1 -1
- package/dist/decode/confidence.js +3 -118
- 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 +66 -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/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 +140 -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 +58 -0
- package/dist/decode/jiao-rule.d.ts.map +1 -0
- package/dist/decode/jiao-rule.js +76 -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 +82 -0
- package/dist/decode/lattice-types.d.ts.map +1 -0
- package/dist/decode/lattice-types.js +44 -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 +31 -0
- package/dist/decode/polyphone-rules.d.ts.map +1 -0
- package/dist/decode/polyphone-rules.js +159 -0
- package/dist/decode/polyphone-rules.js.map +1 -0
- package/dist/decode/reading-rules.d.ts +2 -97
- package/dist/decode/reading-rules.d.ts.map +1 -1
- package/dist/decode/reading-rules.js +4 -365
- 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/sandhi-tones.d.ts +69 -0
- package/dist/decode/sandhi-tones.d.ts.map +1 -0
- package/dist/decode/sandhi-tones.js +88 -0
- package/dist/decode/sandhi-tones.js.map +1 -0
- package/dist/decode/sandhi.d.ts +1 -1
- package/dist/decode/sandhi.d.ts.map +1 -1
- package/dist/decode/sandhi.js +1 -81
- 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 +28 -0
- package/dist/decode/write-run.d.ts.map +1 -0
- package/dist/decode/write-run.js +77 -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 +80 -0
- package/dist/dictionary/cedict-senses.d.ts.map +1 -0
- package/dist/dictionary/cedict-senses.js +114 -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/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 +121 -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-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 +30 -713
- 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 +38 -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/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 +1 -1
|
@@ -1,320 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { traditionalForms } from "./artifact.js";
|
|
6
|
-
import { NEUTRAL_SENSE_WORDS } from "./neutral-senses.js";
|
|
7
|
-
/**
|
|
8
|
-
* A merged dictionary, indexed for the assertions to interrogate.
|
|
9
|
-
*/
|
|
10
|
-
export class BuiltDictionary {
|
|
11
|
-
#byKey;
|
|
12
|
-
entries;
|
|
13
|
-
/**
|
|
14
|
-
* Index entries by every key they claim, headwords first.
|
|
15
|
-
*
|
|
16
|
-
* The order matters for the same reason it does in the artifact: 发 and 髮
|
|
17
|
-
* both claim 发, and the entry the key names has to win.
|
|
18
|
-
*/
|
|
19
|
-
constructor(entries) {
|
|
20
|
-
const byKey = new Map();
|
|
21
|
-
for (const entry of entries) {
|
|
22
|
-
byKey.set(entry.hans, entry);
|
|
23
|
-
}
|
|
24
|
-
for (const entry of entries) {
|
|
25
|
-
for (const form of traditionalForms(entry)) {
|
|
26
|
-
if (!byKey.has(form)) {
|
|
27
|
-
byKey.set(form, entry);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
this.#byKey = byKey;
|
|
32
|
-
this.entries = entries;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Every reading the dictionary holds, under every locale it holds one for.
|
|
36
|
-
*/
|
|
37
|
-
*#readings() {
|
|
38
|
-
for (const entry of this.entries) {
|
|
39
|
-
yield* [
|
|
40
|
-
entry.readings.cn,
|
|
41
|
-
entry.readings.tw ?? [],
|
|
42
|
-
...(entry.alternates ?? []),
|
|
43
|
-
];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* The entry for a word under either script, or undefined.
|
|
48
|
-
*/
|
|
49
|
-
get(word) {
|
|
50
|
-
return this.#byKey.get(word);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* A word's zh-CN reading in tone-marked notation, or undefined.
|
|
54
|
-
*/
|
|
55
|
-
reading(word) {
|
|
56
|
-
const entry = this.#byKey.get(word);
|
|
57
|
-
return entry === undefined
|
|
58
|
-
? undefined
|
|
59
|
-
: entry.readings.cn.map((syllable) => writeSyllable(syllable)).join(" ");
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Every distinct toneless syllable the dictionary uses.
|
|
63
|
-
*/
|
|
64
|
-
syllableInventory() {
|
|
65
|
-
const inventory = new Set();
|
|
66
|
-
for (const reading of this.#readings()) {
|
|
67
|
-
for (const syllable of reading) {
|
|
68
|
-
inventory.add(writeSyllable({ ...syllable, erhua: false, tone: undefined }));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return inventory;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Every syllable the dictionary uses that is not in the tone the inventory
|
|
75
|
-
* says that syllable is written in.
|
|
76
|
-
*
|
|
77
|
-
* The tones are read off the dictionary in the first place, so this is empty
|
|
78
|
-
* by construction — until a source refresh brings in a reading nobody has
|
|
79
|
-
* seen, which is exactly when a reader would start handing that syllable
|
|
80
|
-
* back and the table would have to be regenerated.
|
|
81
|
-
*/
|
|
82
|
-
unattestedTones() {
|
|
83
|
-
const unattested = new Set();
|
|
84
|
-
for (const reading of this.#readings()) {
|
|
85
|
-
for (const syllable of reading) {
|
|
86
|
-
if (!isAttestedTone(syllable)) {
|
|
87
|
-
unattested.add(writeSyllable({ ...syllable, erhua: false }));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return unattested;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* jieba's tag for a 语气词, which is what 吧, 呢 and 吗 are.
|
|
96
|
-
*/
|
|
97
|
-
const PARTICLE_TAG = "y";
|
|
98
|
-
/**
|
|
99
|
-
* The 语气词 the sources themselves do not lead with a 轻声 for.
|
|
100
|
-
*
|
|
101
|
-
* The rule below is that the words a character appears in must not take the
|
|
102
|
-
* default away from its 轻声, not that a 语气词 is always neutral. For these
|
|
103
|
-
* three the reading that leads was never the neutral one and no word put it
|
|
104
|
-
* there: `kMandarin` names 呃 `è` and 哩 `lī`, and `kHanyuPinlu` ranks 呵 as
|
|
105
|
-
* `ā(392)` over `hē(64)`, all of them counting the bare character.
|
|
106
|
-
*/
|
|
107
|
-
const FULL_TONE_PARTICLES = new Set(["呃", "呵", "哩"]);
|
|
108
|
-
/**
|
|
109
|
-
* Assert one word reads a particular way.
|
|
110
|
-
*/
|
|
111
|
-
function reads(word, expected, why) {
|
|
112
|
-
return {
|
|
113
|
-
description: `${word} → ${expected} (${why})`,
|
|
114
|
-
check: (dictionary) => {
|
|
115
|
-
const actual = dictionary.reading(word);
|
|
116
|
-
if (actual === undefined) {
|
|
117
|
-
return `${word} is missing from the dictionary`;
|
|
118
|
-
}
|
|
119
|
-
return actual === expected
|
|
120
|
-
? undefined
|
|
121
|
-
: `${word} reads ${actual}, expected ${expected}`;
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* What must hold of every build, or no artifact is produced.
|
|
127
|
-
*
|
|
128
|
-
* These test the **stored** form, which is deliberately not what a user sees:
|
|
129
|
-
* sandhi is normalised out of the dictionary and reapplied at runtime, so
|
|
130
|
-
* 一丁不识 is stored as `yī dīng bù shí` and only becomes `yì dīng bù shí` after
|
|
131
|
-
* the runtime pass. The gold corpus asserts that output form. Asserting `yì`
|
|
132
|
-
* here would be permanently unsatisfiable — see MERGE.md.
|
|
133
|
-
*
|
|
134
|
-
* Each one stands for a whole class of upstream defect that a source refresh
|
|
135
|
-
* could reintroduce, so a failure here means the merge no longer repairs
|
|
136
|
-
* something it used to, not merely that one word is wrong.
|
|
137
|
-
*/
|
|
138
|
-
export const BUILD_ASSERTIONS = [
|
|
139
|
-
reads("玩儿", "wánr", "儿化 repaired from CC-CEDICT's r5"),
|
|
140
|
-
reads("女儿", "nǚ ér", "儿 keeps its own syllable here"),
|
|
141
|
-
reads("这儿", "zhèr", "儿化 despite upstream writing a tone on the er"),
|
|
142
|
-
reads("儿子", "ér zi", "儿化 exception list consulted"),
|
|
143
|
-
reads("一丁不识", "yī dīng bù shí", "一 sandhi normalised out"),
|
|
144
|
-
reads("一不小心", "yī bù xiǎo xīn", "一 and 不 sandhi normalised out"),
|
|
145
|
-
reads("大夫", "dài fu", "override applied over both sources"),
|
|
146
|
-
reads("东西", "dōng xi", "the thing, not the compass directions"),
|
|
147
|
-
reads("东西方", "dōng xī fāng", "and the directions where that is the word"),
|
|
148
|
-
reads("告诉", "gào su", "the everyday verb, not filing a complaint"),
|
|
149
|
-
reads("银行", "yín háng", "polyphone survives"),
|
|
150
|
-
reads("行长", "háng zhǎng", "polyphone survives"),
|
|
151
|
-
reads("头发", "tóu fa", "CC-CEDICT wins on the neutral tone"),
|
|
152
|
-
reads("还是", "hái shi", "CC-CEDICT wins on the neutral tone"),
|
|
153
|
-
reads("頭髮", "tóu fa", "繁體 derived using the reading, and keyed directly"),
|
|
154
|
-
reads("重複", "chóng fù", "one of two 繁體 spellings, both keyed"),
|
|
155
|
-
reads("重覆", "chóng fù", "the other, on the same entry"),
|
|
156
|
-
reads("下麵", "xià miàn", "both spellings of a word CC-CEDICT writes twice"),
|
|
157
|
-
// The 简体 phrase corpus carries a few 繁體 headwords and reads them as
|
|
158
|
-
// though the characters were 简体 — 徵 as `zhǐ` rather than as 征, 沈 as the
|
|
159
|
-
// surname rather than as 沉. Left as entries of their own they outrank the
|
|
160
|
-
// 繁體 key derived from the 简体 entry, and the word reads one way in a tier
|
|
161
|
-
// holding the phrase tail and another way in a tier without it.
|
|
162
|
-
reads("特徵", "tè zhēng", "not tè zhǐ, which is 徵 read as itself"),
|
|
163
|
-
reads("沈溺", "chén nì", "not shěn nì, which is 沈 read as the surname"),
|
|
164
|
-
reads("蝨子", "shī zi", "not shī zǐ, which is 子 read with its full tone"),
|
|
165
|
-
// kHanyuPinlu writes 李 as `li(36)`, with no tone mark. Read as 轻声 — which
|
|
166
|
-
// is what an unmarked reading means everywhere else in source data — 李华
|
|
167
|
-
// comes out `Li Huá`. The other Unihan fields all write `lǐ`, and that is
|
|
168
|
-
// what settles it. 们 is the control: genuinely neutral, and written bare by
|
|
169
|
-
// the other fields too, so it must not be "corrected".
|
|
170
|
-
reads("李", "lǐ", "a tone kHanyuPinlu left off is restored"),
|
|
171
|
-
reads("们", "men", "a genuine 轻声 is not given a tone it never had"),
|
|
172
|
-
reads("吧", "ba", "the 语气词, not the 酒吧 the corpus mass counts"),
|
|
173
|
-
reads("酒吧", "jiǔ bā", "and the word the character keeps its full tone in"),
|
|
174
|
-
// kHanyuPinlu writes 西 as `xi(902) xī(738)`, and the 902 are 东西: a 轻声 the
|
|
175
|
-
// field counted only inside words is not the bare character's reading. 吗 is
|
|
176
|
-
// the control — CC-CEDICT calls it a question particle in its own right, and
|
|
177
|
-
// a particle's whole use *is* the bare character.
|
|
178
|
-
{
|
|
179
|
-
// The table names words and lets CC-CEDICT supply the reading, so the way
|
|
180
|
-
// it can fail silently is a source refresh dropping or retoning the 轻声
|
|
181
|
-
// sense — after which the word would quietly go back to the full-tone
|
|
182
|
-
// homograph the list exists to get away from.
|
|
183
|
-
description: "every word on the 轻声 sense list reads with one",
|
|
184
|
-
check: (dictionary) => {
|
|
185
|
-
const wrong = NEUTRAL_SENSE_WORDS.filter((listed) => !(dictionary.get(listed.word)?.readings.cn ?? []).some((syllable) => syllable.tone === NEUTRAL_TONE)).map((listed) => `${listed.word} ${dictionary.reading(listed.word) ?? "(missing)"}`);
|
|
186
|
-
return wrong.length === 0
|
|
187
|
-
? undefined
|
|
188
|
-
: `listed for their 轻声 sense and not reading one: ${wrong.join(", ")}`;
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
reads("西", "xī", "a 轻声 counted only inside words does not lead"),
|
|
192
|
-
reads("子", "zǐ", "and a suffix sense is not a claim about the character"),
|
|
193
|
-
reads("夫", "fū", "nor is 大夫's and 丈夫's reduction"),
|
|
194
|
-
reads("吗", "ma", "but a 语气词 CC-CEDICT reads 轻声 alone keeps it"),
|
|
195
|
-
reads("得", "de", "and so does the structural particle"),
|
|
196
|
-
{
|
|
197
|
-
// The corpus mass ranking the character defaults counts a character only
|
|
198
|
-
// inside the words the dictionary holds, and a 语气词 is never inside one:
|
|
199
|
-
// every 吧 it can reach is 酒吧, 网吧 or 吧台, and the only 呗 is 梵呗.
|
|
200
|
-
// Left to it the particle takes the reading of the noun, which is what 吧
|
|
201
|
-
// `bā` and 呗 `bài` were. A 语气词 is the one part of speech whose whole
|
|
202
|
-
// use is the bare character, so its 轻声 is what words cannot vote on.
|
|
203
|
-
description: "no 语气词 ranks a full tone above its own 轻声",
|
|
204
|
-
check: (dictionary) => {
|
|
205
|
-
const wrong = dictionary.entries
|
|
206
|
-
.filter((entry) => entry.partOfSpeech === PARTICLE_TAG &&
|
|
207
|
-
characterCount(entry.hans) === 1 &&
|
|
208
|
-
!FULL_TONE_PARTICLES.has(entry.hans) &&
|
|
209
|
-
entry.readings.cn[0]?.tone !== NEUTRAL_TONE &&
|
|
210
|
-
(entry.alternates ?? []).some((reading) => reading[0]?.tone === NEUTRAL_TONE))
|
|
211
|
-
.map((entry) => `${entry.hans} ${dictionary.reading(entry.hans) ?? ""}`);
|
|
212
|
-
return wrong.length === 0
|
|
213
|
-
? undefined
|
|
214
|
-
: `语气词 reading a full tone over a 轻声 they also have: ${wrong.join(", ")}`;
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
description: "北京 is a proper noun (jieba POS carried through)",
|
|
219
|
-
check: (dictionary) => dictionary.get("北京")?.isProperNoun === true
|
|
220
|
-
? undefined
|
|
221
|
-
: "北京 is not marked as a proper noun",
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
// jieba tags all four of these a proper noun; CC-CEDICT writes their
|
|
225
|
-
// pinyin in lower case, and the decoder capitalises straight off this bit.
|
|
226
|
-
description: "沙发, 城市, 阿姨 and 长大 are not proper nouns",
|
|
227
|
-
check: (dictionary) => {
|
|
228
|
-
const wrong = ["沙发", "城市", "阿姨", "长大"].filter((word) => dictionary.get(word)?.isProperNoun === true);
|
|
229
|
-
return wrong.length === 0
|
|
230
|
-
? undefined
|
|
231
|
-
: `marked as proper nouns: ${wrong.join(", ")}`;
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
// The veto only demotes. These stay proper nouns, and 人民政府 is the
|
|
236
|
-
// control that shows the veto still fires on an institution.
|
|
237
|
-
description: "齐白石, 国务院 and 湖北 stay proper nouns",
|
|
238
|
-
check: (dictionary) => {
|
|
239
|
-
const wrong = ["齐白石", "国务院", "湖北"].filter((word) => dictionary.get(word)?.isProperNoun !== true);
|
|
240
|
-
return wrong.length === 0
|
|
241
|
-
? undefined
|
|
242
|
-
: `no longer proper nouns: ${wrong.join(", ")}`;
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
// The gap composeLocaleDeltas closes, and the two ways it must not close
|
|
247
|
-
// it. 運行狀況 contains the marked word 行狀 and cuts elsewhere; 一个个地
|
|
248
|
-
// ends in a character whose delta is a different sense of 地 entirely.
|
|
249
|
-
description: "垃圾分類 inherits 垃圾's 國語 reading, 運行狀況 inherits nothing",
|
|
250
|
-
check: (dictionary) => {
|
|
251
|
-
const taiwan = (word) => dictionary
|
|
252
|
-
.get(word)
|
|
253
|
-
?.readings.tw?.map((syllable) => writeSyllable(syllable))
|
|
254
|
-
.join(" ");
|
|
255
|
-
const composed = taiwan("垃圾分类");
|
|
256
|
-
if (composed !== "lè sè fēn lèi") {
|
|
257
|
-
return `垃圾分类 reads ${composed ?? "nothing"} in zh-TW, expected lè sè fēn lèi`;
|
|
258
|
-
}
|
|
259
|
-
const wrong = ["运行状况", "一个个地", "相亲相爱"].filter((word) => taiwan(word) !== undefined);
|
|
260
|
-
return wrong.length === 0
|
|
261
|
-
? undefined
|
|
262
|
-
: `composed a zh-TW reading for: ${wrong.join(", ")}`;
|
|
263
|
-
},
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
description: "头发 derives 頭髮 rather than 頭發",
|
|
267
|
-
check: (dictionary) => {
|
|
268
|
-
const hant = dictionary.get("头发")?.hant;
|
|
269
|
-
return hant === "頭髮"
|
|
270
|
-
? undefined
|
|
271
|
-
: `头发 derived ${hant ?? "nothing"}, expected 頭髮`;
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
// Membership rather than a count. MERGE.md asked for "exactly 408 after the
|
|
276
|
-
// merge", which is the phrase corpus's own inventory — but the merged
|
|
277
|
-
// dictionary also carries Unihan's and CC-CEDICT's rare characters, whose
|
|
278
|
-
// readings are legitimately outside it (鞥 ēng, 覅 fiào, 挼 ruá). Fixing the
|
|
279
|
-
// count would either exclude those or bless whatever a refresh adds; naming
|
|
280
|
-
// the permitted set does neither.
|
|
281
|
-
description: "every syllable used is one the inventory knows",
|
|
282
|
-
check: (dictionary) => {
|
|
283
|
-
const unknown = [...dictionary.syllableInventory()].filter((syllable) => !DICTIONARY_SYLLABLES.has(syllable));
|
|
284
|
-
return unknown.length === 0
|
|
285
|
-
? undefined
|
|
286
|
-
: `readings use ${String(unknown.length)} syllable(s) outside the inventory: ${unknown.join(", ")}`;
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
// The romanisation readers narrow an ambiguous spelling on the tone that
|
|
291
|
-
// was written — `lo²` is 羅 luó and not a 咯 that is only ever neutral —
|
|
292
|
-
// so a tone the table has never heard of is a syllable those readers will
|
|
293
|
-
// refuse to hand back. Regenerate `SYLLABLE_TONES` when this fails.
|
|
294
|
-
description: "every syllable is used in a tone the inventory knows",
|
|
295
|
-
check: (dictionary) => {
|
|
296
|
-
const unattested = [...dictionary.unattestedTones()];
|
|
297
|
-
return unattested.length === 0
|
|
298
|
-
? undefined
|
|
299
|
-
: `readings use ${String(unattested.length)} syllable(s) in a tone the inventory does not list: ${unattested.join(", ")}`;
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
description: "every entry's syllable count matches its character count",
|
|
304
|
-
check: (dictionary) => {
|
|
305
|
-
for (const entry of dictionary.entries) {
|
|
306
|
-
const characters = characterCount(entry.hans);
|
|
307
|
-
const erhua = entry.readings.cn.filter((syllable) => syllable.erhua === true).length;
|
|
308
|
-
// Punctuation is written but unread, so it is allowed to have no
|
|
309
|
-
// syllable; a reading may therefore be shorter but never longer.
|
|
310
|
-
if (entry.readings.cn.length + erhua > characters) {
|
|
311
|
-
return `${entry.hans} has ${String(entry.readings.cn.length)} syllables for ${String(characters)} characters`;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return;
|
|
315
|
-
},
|
|
316
|
-
},
|
|
317
|
-
];
|
|
1
|
+
import { BuiltDictionary } from "./built-dictionary.js";
|
|
2
|
+
import { BUILD_ASSERTIONS } from "./build-assertions.js";
|
|
3
|
+
export { BuiltDictionary } from "./built-dictionary.js";
|
|
4
|
+
export { BUILD_ASSERTIONS } from "./build-assertions.js";
|
|
318
5
|
/**
|
|
319
6
|
* Run every build assertion, returning the failures.
|
|
320
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../src/dictionary/assertions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../src/dictionary/assertions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,UAAU,UAAU,CACxB,OAAmC;IAEnC,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IAChD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CACxC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAC5B,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What must hold of every build, or no artifact is produced.
|
|
3
|
+
*
|
|
4
|
+
* These test the **stored** form, which is deliberately not what a user sees:
|
|
5
|
+
* sandhi is normalised out of the dictionary and reapplied at runtime, so
|
|
6
|
+
* 一丁不识 is stored as `yī dīng bù shí` and only becomes `yì dīng bù shí` after
|
|
7
|
+
* the runtime pass. The gold corpus asserts that output form. Asserting `yì`
|
|
8
|
+
* here would be permanently unsatisfiable — see MERGE.md.
|
|
9
|
+
*/
|
|
10
|
+
import type { BuildAssertion } from "./built-dictionary.js";
|
|
11
|
+
export declare const BUILD_ASSERTIONS: readonly BuildAssertion[];
|
|
12
|
+
//# sourceMappingURL=build-assertions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-assertions.d.ts","sourceRoot":"","sources":["../../src/dictionary/build-assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO5D,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAMrD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CHARACTER_READINGS } from "./character-readings.js";
|
|
2
|
+
import { ENTRY_INVARIANTS } from "./entry-invariants.js";
|
|
3
|
+
import { INVENTORY_INVARIANTS } from "./inventory-invariants.js";
|
|
4
|
+
import { TONE_INVARIANTS } from "./tone-invariants.js";
|
|
5
|
+
import { WORD_READINGS } from "./word-readings.js";
|
|
6
|
+
export const BUILD_ASSERTIONS = [
|
|
7
|
+
...WORD_READINGS,
|
|
8
|
+
...CHARACTER_READINGS,
|
|
9
|
+
...TONE_INVARIANTS,
|
|
10
|
+
...ENTRY_INVARIANTS,
|
|
11
|
+
...INVENTORY_INVARIANTS,
|
|
12
|
+
];
|
|
13
|
+
//# sourceMappingURL=build-assertions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-assertions.js","sourceRoot":"","sources":["../../src/dictionary/build-assertions.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD,GAAG,aAAa;IAChB,GAAG,kBAAkB;IACrB,GAAG,eAAe;IAClB,GAAG,gBAAgB;IACnB,GAAG,oBAAoB;CACxB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DictionaryEntry } from "./entry.js";
|
|
2
|
+
/**
|
|
3
|
+
* One thing that must be true of a freshly built dictionary.
|
|
4
|
+
*/
|
|
5
|
+
export interface BuildAssertion {
|
|
6
|
+
readonly description: string;
|
|
7
|
+
/** The failure message, or undefined when the assertion holds. */
|
|
8
|
+
readonly check: (dictionary: BuiltDictionary) => string | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A merged dictionary, indexed for the assertions to interrogate.
|
|
12
|
+
*/
|
|
13
|
+
export declare class BuiltDictionary {
|
|
14
|
+
#private;
|
|
15
|
+
readonly entries: readonly DictionaryEntry[];
|
|
16
|
+
/**
|
|
17
|
+
* Index entries by every key they claim, headwords first.
|
|
18
|
+
*
|
|
19
|
+
* The order matters for the same reason it does in the artifact: 发 and 髮
|
|
20
|
+
* both claim 发, and the entry the key names has to win.
|
|
21
|
+
*/
|
|
22
|
+
constructor(entries: readonly DictionaryEntry[]);
|
|
23
|
+
/**
|
|
24
|
+
* The entry for a word under either script, or undefined.
|
|
25
|
+
*/
|
|
26
|
+
get(word: string): DictionaryEntry | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* A word's zh-CN reading in tone-marked notation, or undefined.
|
|
29
|
+
*/
|
|
30
|
+
reading(word: string): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Every distinct toneless syllable the dictionary uses.
|
|
33
|
+
*/
|
|
34
|
+
syllableInventory(): ReadonlySet<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Every syllable the dictionary uses that is not in the tone the inventory
|
|
37
|
+
* says that syllable is written in.
|
|
38
|
+
*
|
|
39
|
+
* The tones are read off the dictionary in the first place, so this is empty
|
|
40
|
+
* by construction — until a source refresh brings in a reading nobody has
|
|
41
|
+
* seen, which is exactly when a reader would start handing that syllable
|
|
42
|
+
* back and the table would have to be regenerated.
|
|
43
|
+
*/
|
|
44
|
+
unattestedTones(): ReadonlySet<string>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=built-dictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"built-dictionary.d.ts","sourceRoot":"","sources":["../../src/dictionary/built-dictionary.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,eAAe,KAAK,MAAM,GAAG,SAAS,CAAC;CACrE;AAED;;GAEG;AACH,qBAAa,eAAe;;IAG1B,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;IAE7C;;;;;OAKG;IACH,YAAY,OAAO,EAAE,SAAS,eAAe,EAAE,EAc9C;IAeD;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAE7C;IAED;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKxC;IAED;;OAEG;IACH,iBAAiB,IAAI,WAAW,CAAC,MAAM,CAAC,CAUvC;IAED;;;;;;;;OAQG;IACH,eAAe,IAAI,WAAW,CAAC,MAAM,CAAC,CAUrC;CACF"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dictionary a build assertion is asked about.
|
|
3
|
+
*
|
|
4
|
+
* Indexed the way the artifact is, so that an assertion interrogates the same
|
|
5
|
+
* lookups a reader would rather than the entry list behind them.
|
|
6
|
+
*/
|
|
7
|
+
import { isAttestedTone } from "../syllable/inventory.js";
|
|
8
|
+
import { writeSyllable } from "../syllable/syllable.js";
|
|
9
|
+
import { traditionalForms } from "./artifact.js";
|
|
10
|
+
/**
|
|
11
|
+
* A merged dictionary, indexed for the assertions to interrogate.
|
|
12
|
+
*/
|
|
13
|
+
export class BuiltDictionary {
|
|
14
|
+
#byKey;
|
|
15
|
+
entries;
|
|
16
|
+
/**
|
|
17
|
+
* Index entries by every key they claim, headwords first.
|
|
18
|
+
*
|
|
19
|
+
* The order matters for the same reason it does in the artifact: 发 and 髮
|
|
20
|
+
* both claim 发, and the entry the key names has to win.
|
|
21
|
+
*/
|
|
22
|
+
constructor(entries) {
|
|
23
|
+
const byKey = new Map();
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
byKey.set(entry.hans, entry);
|
|
26
|
+
}
|
|
27
|
+
for (const entry of entries) {
|
|
28
|
+
for (const form of traditionalForms(entry)) {
|
|
29
|
+
if (!byKey.has(form)) {
|
|
30
|
+
byKey.set(form, entry);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
this.#byKey = byKey;
|
|
35
|
+
this.entries = entries;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Every reading the dictionary holds, under every locale it holds one for.
|
|
39
|
+
*/
|
|
40
|
+
*#readings() {
|
|
41
|
+
for (const entry of this.entries) {
|
|
42
|
+
yield* [
|
|
43
|
+
entry.readings.cn,
|
|
44
|
+
entry.readings.tw ?? [],
|
|
45
|
+
...(entry.alternates ?? []),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The entry for a word under either script, or undefined.
|
|
51
|
+
*/
|
|
52
|
+
get(word) {
|
|
53
|
+
return this.#byKey.get(word);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A word's zh-CN reading in tone-marked notation, or undefined.
|
|
57
|
+
*/
|
|
58
|
+
reading(word) {
|
|
59
|
+
const entry = this.#byKey.get(word);
|
|
60
|
+
return entry === undefined
|
|
61
|
+
? undefined
|
|
62
|
+
: entry.readings.cn.map((syllable) => writeSyllable(syllable)).join(" ");
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Every distinct toneless syllable the dictionary uses.
|
|
66
|
+
*/
|
|
67
|
+
syllableInventory() {
|
|
68
|
+
const inventory = new Set();
|
|
69
|
+
for (const reading of this.#readings()) {
|
|
70
|
+
for (const syllable of reading) {
|
|
71
|
+
inventory.add(writeSyllable({ ...syllable, erhua: false, tone: undefined }));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return inventory;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Every syllable the dictionary uses that is not in the tone the inventory
|
|
78
|
+
* says that syllable is written in.
|
|
79
|
+
*
|
|
80
|
+
* The tones are read off the dictionary in the first place, so this is empty
|
|
81
|
+
* by construction — until a source refresh brings in a reading nobody has
|
|
82
|
+
* seen, which is exactly when a reader would start handing that syllable
|
|
83
|
+
* back and the table would have to be regenerated.
|
|
84
|
+
*/
|
|
85
|
+
unattestedTones() {
|
|
86
|
+
const unattested = new Set();
|
|
87
|
+
for (const reading of this.#readings()) {
|
|
88
|
+
for (const syllable of reading) {
|
|
89
|
+
if (!isAttestedTone(syllable)) {
|
|
90
|
+
unattested.add(writeSyllable({ ...syllable, erhua: false }));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return unattested;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=built-dictionary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"built-dictionary.js","sourceRoot":"","sources":["../../src/dictionary/built-dictionary.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAiB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAYjD;;GAEG;AACH,MAAM,OAAO,eAAe;IACjB,MAAM,CAAuC;IAE7C,OAAO,CAA6B;IAE7C;;;;;OAKG;IACH,YAAY,OAAmC;QAC7C,MAAM,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;QACjD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,KAAK,MAAM,IAAI,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBACrB,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,CAAC,SAAS;QACR,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjC,KAAK,CAAC,CAAC;gBACL,KAAK,CAAC,QAAQ,CAAC,EAAE;gBACjB,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE;gBACvB,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC;aAC5B,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAY;QAClB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,KAAK,KAAK,SAAS;YACxB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;QACpC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACvC,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;gBAC/B,SAAS,CAAC,GAAG,CACX,aAAa,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAC9D,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;;;OAQG;IACH,eAAe;QACb,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;QACrC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACvC,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;gBAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC9B,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBAC/D,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { CedictEntry } from "../sources/cedict.js";
|
|
2
|
+
import type { Syllable } from "../syllable/syllable.js";
|
|
3
|
+
/**
|
|
4
|
+
* Whether a phrase-corpus headword is really the 繁體 spelling of another word.
|
|
5
|
+
*
|
|
6
|
+
* `large_pinyin.txt` is a 简体 corpus, and where it carries a 繁體 headword
|
|
7
|
+
* anyway it has read it as though the characters were 简体: 特徵 is `tè zhǐ`
|
|
8
|
+
* there because 徵 alone is `zhǐ`, 沈溺 is `shěn nì` because 沈 alone is the
|
|
9
|
+
* surname, 蝨子 is `shī zǐ`, 纔然 is `shān rán`. Every one of those is a word
|
|
10
|
+
* whose 简体 form the corpus also carries, correctly.
|
|
11
|
+
*
|
|
12
|
+
* Left in, each becomes an entry of its own that outranks the 繁體 key the
|
|
13
|
+
* derivation would have hung on the 简体 entry, so the word reads one way in a
|
|
14
|
+
* tier holding the phrase tail and another way in a tier without it.
|
|
15
|
+
*
|
|
16
|
+
* So the corpus is held to its own contract: a headword CC-CEDICT knows only as
|
|
17
|
+
* the 繁體 spelling of a different 简体 word contributes no entry, and the word
|
|
18
|
+
* keeps the reading CC-CEDICT pairs it with. It is 72 headwords, 13 of which
|
|
19
|
+
* the corpus reads wrongly; the other 59 arrive at the same reading either way.
|
|
20
|
+
*
|
|
21
|
+
* Narrow on purpose. 2,854 corpus headwords contain a 繁體-only character and
|
|
22
|
+
* only these 72 are ones CC-CEDICT pairs — the rest are rare or mixed-script
|
|
23
|
+
* words whose characters do read them, and dropping those would lose coverage
|
|
24
|
+
* to fix nothing.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isSpeltTraditionally(word: string, byWord: ReadonlyMap<string, readonly CedictEntry[]>, byHant: ReadonlyMap<string, readonly CedictEntry[]>): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* CC-CEDICT's entries for a word, keyed by one of its two written forms.
|
|
29
|
+
*/
|
|
30
|
+
export declare function indexCedict(cedict: readonly CedictEntry[], formOf: (entry: CedictEntry) => string): ReadonlyMap<string, readonly CedictEntry[]>;
|
|
31
|
+
/**
|
|
32
|
+
* A word's readings as CC-CEDICT gives them, one per sense.
|
|
33
|
+
*/
|
|
34
|
+
export declare function cedictReadingsOf(word: string, entries: readonly CedictEntry[]): readonly (readonly Syllable[])[];
|
|
35
|
+
/**
|
|
36
|
+
* Whether a proposed 國語 reading is really another 普通话 sense of the word.
|
|
37
|
+
*
|
|
38
|
+
* The test that separates a locale shift from a sense selection, which the
|
|
39
|
+
* sources write the same way and mean differently. 地 is offered `dì` against a
|
|
40
|
+
* 普通话 `de` — but CC-CEDICT lists 地[de5] and 地[di4] as two entries, so `dì`
|
|
41
|
+
* is what 地 reads in 普通话 when it means the ground, not what 國語 does to the
|
|
42
|
+
* particle. The adverbial 地 is `de` in Taipei too, and 4,240 entries end in it.
|
|
43
|
+
* 都 is the same shape, and so are 着, 应, 差, 称, 斗, 舍, 薄 and 万.
|
|
44
|
+
*
|
|
45
|
+
* A genuine delta leaves no such trace: nothing in 普通话 reads 和 as `hàn`, 期
|
|
46
|
+
* as `qí` or 垃 as `lè`, which is why those survive this and 71 characters and
|
|
47
|
+
* 3 words do not.
|
|
48
|
+
*
|
|
49
|
+
* Only CC-CEDICT is consulted. Unihan's reading fields carry rare and historical
|
|
50
|
+
* pronunciations alongside current ones — 驯 is listed `xún` somewhere in them —
|
|
51
|
+
* and a reading no one uses today is not evidence that a source meant a sense
|
|
52
|
+
* rather than a locale.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isOwnSense(taiwan: readonly Syllable[], senseReadings: readonly (readonly Syllable[])[]): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether a character's `Taiwan pr.` note describes one sense rather than the
|
|
57
|
+
* character.
|
|
58
|
+
*
|
|
59
|
+
* The other half of the sense test, and the one {@link isOwnSense} cannot do.
|
|
60
|
+
* That test asks whether the offered reading is a 普通话 sense of the word; this
|
|
61
|
+
* asks whether the note was ever about the whole word to begin with. 從's
|
|
62
|
+
* `Taiwan pr. [zong4]` sits on three of its eight senses — 侍從, 從兄弟, 從犯 —
|
|
63
|
+
* and 教育部's dictionary agrees with CC-CEDICT about which: 跟隨, 依順, 參與 and
|
|
64
|
+
* the preposition are `cóng` in Taipei exactly as they are in Beijing. Applying
|
|
65
|
+
* it to the headword made 我从北京来 read `wǒ zòng Běijīng lái`. 會 (`huǐ`, only
|
|
66
|
+
* 一會兒), 勞 (`lào`, only 慰勞) and 燥 (`sào`, only 肉燥) are the same shape.
|
|
67
|
+
*
|
|
68
|
+
* A note the entry leads with is kept, because the leading sense is what the
|
|
69
|
+
* character means with nothing to narrow it: 和's `hàn` is on the conjunction,
|
|
70
|
+
* which is what a bare 和 almost always is.
|
|
71
|
+
*
|
|
72
|
+
* **Only a character is tested this way.** Its entry is what every occurrence
|
|
73
|
+
* no longer word covers falls back to, so it has to carry the reading that
|
|
74
|
+
* survives out of context; a multi-character headword is reached only where
|
|
75
|
+
* that exact word is written. Four of them carry an inline note — 相親, 載具,
|
|
76
|
+
* 高挑 and 樂色 — and only 相親 has senses that differ, its dominant one being
|
|
77
|
+
* the matchmaking sense that really is `xiàngqīn`.
|
|
78
|
+
*/
|
|
79
|
+
export declare function isSenseScopedNote(word: string, sense: CedictEntry | undefined): boolean;
|
|
80
|
+
//# sourceMappingURL=cedict-senses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cedict-senses.d.ts","sourceRoot":"","sources":["../../src/dictionary/cedict-senses.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,EACnD,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,GAClD,OAAO,CAOT;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,MAAM,GACrC,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,CAY7C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,WAAW,EAAE,GAC9B,SAAS,CAAC,SAAS,QAAQ,EAAE,CAAC,EAAE,CAIlC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,SAAS,QAAQ,EAAE,EAC3B,aAAa,EAAE,SAAS,CAAC,SAAS,QAAQ,EAAE,CAAC,EAAE,GAC9C,OAAO,CAET;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,GAAG,SAAS,GAC7B,OAAO,CAET"}
|