@kensio/pinyinjs 1.7.3 → 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 +2 -2
package/dist/format/slug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../src/format/slug.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../src/format/slug.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQ3E;;;;;;GAMG;AACH,SAAS,KAAK,CACZ,KAAwB,EACxB,KAAa,EACb,SAAiB,EACjB,MAAc;IAEd,MAAM,IAAI,GAAG,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAC9E,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtE,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;YACvB,MAAM;QACR,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChB,IAAI,IAAI,IAAI,CAAC;IACf,CAAC;IACD,2EAA2E;IAC3E,0EAA0E;IAC1E,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACtB,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,KAAK,SAAS;QAC7C,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACxB,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED;;GAEG;AACH,SAAS,OAAO,CACd,KAAwB,EACxB,IAAY,EACZ,SAAiB;IAEjB,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,IAAI,CAClB,UAAsB,EACtB,IAAY,EACZ,OAAO,GAAgB,EAAE;IAEzB,MAAM,EAAE,SAAS,GAAG,GAAG,EAAE,QAAQ,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC9D,MAAM,MAAM,GAAG,qBAAqB,CAAC,UAAU,EAAE,IAAI,EAAE;QACrD,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QAC/D,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QAC/D,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,MAAM;QAClC,0EAA0E;QAC1E,yEAAyE;QACzE,2DAA2D;QAC3D,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,MAAM;KACpB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,MAAM,MAAM,GACV,SAAS,KAAK,SAAS;QACrB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAEjD,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACjD,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reading this library produces for a text, as the checker compares it.
|
|
3
|
+
*
|
|
4
|
+
* One of the two sides `check.ts` pairs up; `typed-reading.ts` is the other.
|
|
5
|
+
* They are separate because they are reduced from different things — this from
|
|
6
|
+
* a conversion, that from a string somebody typed — and meet only in being the
|
|
7
|
+
* same shape, a syllable at a time with what was on offer beside it.
|
|
8
|
+
*/
|
|
9
|
+
import type { ConvertOptions } from "../decode/convert.js";
|
|
10
|
+
import type { Dictionary } from "../dictionary/dictionary.js";
|
|
11
|
+
import type { Syllable } from "../syllable/syllable.js";
|
|
12
|
+
import type { Tone } from "../tone/tone.js";
|
|
13
|
+
/**
|
|
14
|
+
* An expected syllable, with everything a typed one is allowed to be.
|
|
15
|
+
*/
|
|
16
|
+
export interface ExpectedSyllable {
|
|
17
|
+
readonly syllable: Syllable;
|
|
18
|
+
/**
|
|
19
|
+
* Which tones each acceptable spelling may carry.
|
|
20
|
+
*
|
|
21
|
+
* Keyed by the toneless spelling, because the two questions a verdict asks
|
|
22
|
+
* are separate: an unknown spelling is the wrong syllable, and a known
|
|
23
|
+
* spelling with an unlisted tone is the right syllable in the wrong tone.
|
|
24
|
+
*/
|
|
25
|
+
readonly accepted: ReadonlyMap<string, ReadonlySet<Tone | undefined>>;
|
|
26
|
+
/** Whether a word may begin here. */
|
|
27
|
+
readonly acceptsBreak: boolean;
|
|
28
|
+
/** Whether this may be written on to the syllable before it. */
|
|
29
|
+
readonly acceptsJoin: boolean;
|
|
30
|
+
readonly source: string | undefined;
|
|
31
|
+
readonly at: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Read the text, and work out what a typed syllable is allowed to be.
|
|
35
|
+
*
|
|
36
|
+
* The three conversions each answer a different question; see
|
|
37
|
+
* {@link readingsThreeWays}. What is left here is putting one syllable's worth
|
|
38
|
+
* of all three together.
|
|
39
|
+
*/
|
|
40
|
+
export declare function expectedReading(dictionary: Dictionary, text: string, options: ConvertOptions): readonly ExpectedSyllable[];
|
|
41
|
+
//# sourceMappingURL=check-readings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-readings.d.ts","sourceRoot":"","sources":["../../src/grade/check-readings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAO5C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;IACtE,qCAAqC;IACrC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,SAAS,gBAAgB,EAAE,CA+B7B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { acceptedReadings, readingsThreeWays, rejectedReadings, } from "./reading-tolerance.js";
|
|
2
|
+
/**
|
|
3
|
+
* Read the text, and work out what a typed syllable is allowed to be.
|
|
4
|
+
*
|
|
5
|
+
* The three conversions each answer a different question; see
|
|
6
|
+
* {@link readingsThreeWays}. What is left here is putting one syllable's worth
|
|
7
|
+
* of all three together.
|
|
8
|
+
*/
|
|
9
|
+
export function expectedReading(dictionary, text, options) {
|
|
10
|
+
const { written, said, spaced } = readingsThreeWays(dictionary, text, options);
|
|
11
|
+
return written.map(({ piece, at, junction }, index) => {
|
|
12
|
+
// Sliced rather than indexed, so that a conversion somehow reporting fewer
|
|
13
|
+
// syllables than the others contributes nothing rather than needing a
|
|
14
|
+
// fallback: the caller's own conversion decides alone.
|
|
15
|
+
const alternate = said
|
|
16
|
+
.slice(index, index + 1)
|
|
17
|
+
.map((one) => one.piece.syllable);
|
|
18
|
+
const other = spaced.slice(index, index + 1).map((one) => one.junction);
|
|
19
|
+
return {
|
|
20
|
+
syllable: piece.syllable,
|
|
21
|
+
accepted: acceptedReadings([
|
|
22
|
+
piece.syllable,
|
|
23
|
+
...alternate,
|
|
24
|
+
...rejectedReadings(piece),
|
|
25
|
+
]),
|
|
26
|
+
// A hyphen is neither a break nor a join, and so allows both: it is a
|
|
27
|
+
// boundary the standard writes inside a word, and a learner rendering it
|
|
28
|
+
// as a space has not invented one.
|
|
29
|
+
acceptsBreak: junction !== "join" || other.some((one) => one !== "join"),
|
|
30
|
+
acceptsJoin: junction !== "break" || other.some((one) => one !== "break"),
|
|
31
|
+
source: piece.source,
|
|
32
|
+
at,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=check-readings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-readings.js","sourceRoot":"","sources":["../../src/grade/check-readings.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAuBhC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAsB,EACtB,IAAY,EACZ,OAAuB;IAEvB,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,iBAAiB,CACjD,UAAU,EACV,IAAI,EACJ,OAAO,CACR,CAAC;IAEF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE;QACpD,2EAA2E;QAC3E,sEAAsE;QACtE,uDAAuD;QACvD,MAAM,SAAS,GAAG,IAAI;aACnB,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC;aACvB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxE,OAAO;YACL,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,gBAAgB,CAAC;gBACzB,KAAK,CAAC,QAAQ;gBACd,GAAG,SAAS;gBACZ,GAAG,gBAAgB,CAAC,KAAK,CAAC;aAC3B,CAAC;YACF,sEAAsE;YACtE,yEAAyE;YACzE,mCAAmC;YACnC,YAAY,EAAE,QAAQ,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,MAAM,CAAC;YACxE,WAAW,EAAE,QAAQ,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,OAAO,CAAC;YACzE,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,EAAE;SACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/grade/check.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ConvertOptions } from "../decode/convert.js";
|
|
2
2
|
import type { Dictionary } from "../dictionary/dictionary.js";
|
|
3
3
|
import { type Syllable } from "../syllable/syllable.js";
|
|
4
4
|
/**
|
|
@@ -80,8 +80,8 @@ export interface CheckedSyllable {
|
|
|
80
80
|
* The characters the expected syllable reads.
|
|
81
81
|
*
|
|
82
82
|
* Undefined where a syllable reads on into the characters named before it,
|
|
83
|
-
* exactly as {@link ConvertedPiece.source}
|
|
84
|
-
* expected at all.
|
|
83
|
+
* exactly as {@link import("../decode/convert.js").ConvertedPiece.source}
|
|
84
|
+
* is, and where nothing was expected at all.
|
|
85
85
|
*/
|
|
86
86
|
readonly source: string | undefined;
|
|
87
87
|
/**
|
|
@@ -127,7 +127,7 @@ export interface PinyinCheck {
|
|
|
127
127
|
* and both parse, so `bei3jīng` is not a spelling mistake.
|
|
128
128
|
* - **A reading the decoder itself was unsure of.** Where another reading of
|
|
129
129
|
* the same character was there for the taking, it is accepted — see
|
|
130
|
-
* {@link rejectedReadings}. 银行 is not one of those: the word settles both
|
|
130
|
+
* {@link import("./reading-tolerance.js").rejectedReadings}. 银行 is not one of those: the word settles both
|
|
131
131
|
* syllables, so `yínxíng` really is wrong.
|
|
132
132
|
* - **Sandhi either way.** 你好 is written `nǐ hǎo` and said `ní hǎo`, and 不是
|
|
133
133
|
* is `bú shì` written and `bù shì` underneath. Both pass.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/grade/check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/grade/check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,KAAK,QAAQ,EAAyB,MAAM,yBAAyB,CAAC;AAI/E;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,UAAU,GACV,MAAM,GACN,OAAO,GACP,SAAS,GACT,OAAO,CAAC;AAEZ;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,UAAU,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,WAAW,YAAa,SAAQ,cAAc;IAClD,gEAAgE;IAChE,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAClC;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,CAAC;IAC7C,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;IACxC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IACtC,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,EAAE,CAAC;CACvC;AAkDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,KAAK,CACnB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,YAAiB,GACzB,WAAW,CAuBb"}
|
package/dist/grade/check.js
CHANGED
|
@@ -1,272 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { toCharacters } from "../script/characters.js";
|
|
6
|
-
import { readSyllable, writeSyllableSpelling, } from "../syllable/syllable.js";
|
|
7
|
-
import { NEUTRAL_TONE } from "../tone/tone.js";
|
|
8
|
-
/**
|
|
9
|
-
* The other corner of the sandhi square.
|
|
10
|
-
*
|
|
11
|
-
* A learner may write the underlying tones or the tones actually said, and both
|
|
12
|
-
* are right — 你好 is written `nǐ hǎo` and said `ní hǎo`. Rather than convert
|
|
13
|
-
* four times for the four combinations of {@link SandhiOptions}, this converts
|
|
14
|
-
* twice and inverts both switches at once, which reaches every tone: 一 and 不
|
|
15
|
-
* sandhi applies to syllables in the first and fourth tones, third-tone sandhi
|
|
16
|
-
* only to syllables in the third, so the two passes never touch the same
|
|
17
|
-
* syllable and each one's two forms both appear across the two corners.
|
|
18
|
-
*/
|
|
19
|
-
function oppositeSandhi(sandhi) {
|
|
20
|
-
return {
|
|
21
|
-
yiBu: !(sandhi?.yiBu ?? true),
|
|
22
|
-
thirdTone: !(sandhi?.thirdTone ?? false),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Where each piece's source characters start, in code points.
|
|
27
|
-
*
|
|
28
|
-
* Read off the sources rather than tracked through the conversion, which works
|
|
29
|
-
* because every character of the text is named by exactly one piece — a piece
|
|
30
|
-
* naming none is either pinyin orthography the source has no trace of, such as
|
|
31
|
-
* the space between two words, or a syllable reading on into the characters the
|
|
32
|
-
* piece before it named.
|
|
33
|
-
*/
|
|
34
|
-
function sourcePositions(pieces) {
|
|
35
|
-
const positions = [];
|
|
36
|
-
let at = 0;
|
|
37
|
-
for (const piece of pieces) {
|
|
38
|
-
positions.push(at);
|
|
39
|
-
at += toCharacters(piece.source ?? "").length;
|
|
40
|
-
}
|
|
41
|
-
return positions;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* What a piece written between two syllables makes of the join.
|
|
45
|
-
*
|
|
46
|
-
* Only a hyphen written where the syllables would otherwise have run together
|
|
47
|
-
* is 分词连写's internal boundary; anything else — a space, punctuation, a
|
|
48
|
-
* stretch that was never Han — separates two words.
|
|
49
|
-
*/
|
|
50
|
-
function junctionOver(text, held) {
|
|
51
|
-
return text === "-" && held === "join" ? "hyphen" : "break";
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* The syllables a conversion writes, with their positions and what joins them.
|
|
55
|
-
*
|
|
56
|
-
* A conversion writes its syllables as adjacent pieces within a word — the
|
|
57
|
-
* 隔音符号 is part of a syllable's own spelling rather than a piece of its own —
|
|
58
|
-
* so anything standing between two of them is a boundary, and the hyphen of
|
|
59
|
-
* 分词连写 is the one that is not a word boundary.
|
|
60
|
-
*/
|
|
61
|
-
function readingSyllables(pieces) {
|
|
62
|
-
const positions = sourcePositions(pieces);
|
|
63
|
-
const syllables = [];
|
|
64
|
-
// The first syllable of a text begins a word, whatever comes before it.
|
|
65
|
-
let junction = "break";
|
|
66
|
-
for (const [at, piece] of pieces.entries()) {
|
|
67
|
-
if (piece.syllable === undefined) {
|
|
68
|
-
junction = junctionOver(piece.text, junction);
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
syllables.push({
|
|
72
|
-
piece: { ...piece, syllable: piece.syllable },
|
|
73
|
-
/* c8 ignore next -- one position is recorded for each piece there is */
|
|
74
|
-
at: positions[at] ?? 0,
|
|
75
|
-
junction,
|
|
76
|
-
});
|
|
77
|
-
junction = "join";
|
|
78
|
-
}
|
|
79
|
-
return syllables;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* The readings the decode turned down without much reason to.
|
|
83
|
-
*
|
|
84
|
-
* The decode charges {@link READING_CHARGE} for a word boundary, so a rejected
|
|
85
|
-
* reading costing less than that was available without breaking any dictionary
|
|
86
|
-
* word apart — see {@link import("../decode/confidence.js").isUncertain}, which
|
|
87
|
-
* is the same threshold read as a question rather than as a filter. The library
|
|
88
|
-
* knows it was guessing there, so a learner who guessed the other way is not
|
|
89
|
-
* wrong.
|
|
90
|
-
*
|
|
91
|
-
* Only a rejected reading of exactly the one character this syllable reads is
|
|
92
|
-
* taken. An alternative can cover a different stretch — 玩儿 read as `wánr`
|
|
93
|
-
* competes with 玩 `wán` and 儿 `ér` — and a claim about other characters says
|
|
94
|
-
* nothing about what belongs in this position.
|
|
95
|
-
*/
|
|
96
|
-
function rejectedReadings(piece) {
|
|
97
|
-
const { confidence, source } = piece;
|
|
98
|
-
if (source === undefined || toCharacters(source).length !== 1) {
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
return (confidence?.alternatives ?? []).flatMap((alternative) => {
|
|
102
|
-
const [syllable] = alternative.reading;
|
|
103
|
-
return alternative.cost < READING_CHARGE &&
|
|
104
|
-
alternative.to - alternative.from === 1 &&
|
|
105
|
-
alternative.reading.length === 1 &&
|
|
106
|
-
syllable !== undefined
|
|
107
|
-
? [syllable]
|
|
108
|
-
: [];
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Gather readings into the spellings and tones they allow.
|
|
113
|
-
*
|
|
114
|
-
* The tone is allowed to be undefined only because {@link Syllable.tone} is: a
|
|
115
|
-
* reading that came out of the dictionary always carries one.
|
|
116
|
-
*/
|
|
117
|
-
function acceptedReadings(readings) {
|
|
118
|
-
const accepted = new Map();
|
|
119
|
-
for (const syllable of readings) {
|
|
120
|
-
const base = writeSyllableSpelling(syllable);
|
|
121
|
-
const tones = accepted.get(base) ?? new Set();
|
|
122
|
-
tones.add(syllable.tone);
|
|
123
|
-
accepted.set(base, tones);
|
|
124
|
-
}
|
|
125
|
-
return accepted;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Read the text, and work out what a typed syllable is allowed to be.
|
|
129
|
-
*
|
|
130
|
-
* Three conversions of the same text, and each one answers a different question.
|
|
131
|
-
* The first is the answer itself, with the confidence report beside it. The
|
|
132
|
-
* second is the other corner of the sandhi square, which is where the second
|
|
133
|
-
* form of every tone comes from. The third is the same text written under the
|
|
134
|
-
* other spacing convention, which is where a boundary's tolerance comes from:
|
|
135
|
-
* 分词连写 is what puts 了 on its verb and separates 市 from 南京, and a learner
|
|
136
|
-
* who wrote the words the dictionary knows instead — `tā kàn le`, `Nánjīngshì`
|
|
137
|
-
* — has written one of the two conventions this package implements rather than
|
|
138
|
-
* made a mistake.
|
|
139
|
-
*
|
|
140
|
-
* All three decode identically. Sandhi rewrites tones and 分词连写 moves
|
|
141
|
-
* boundaries; neither touches the syllables underneath, so all three line up one
|
|
142
|
-
* for one.
|
|
143
|
-
*/
|
|
144
|
-
function expectedReading(dictionary, text, options) {
|
|
145
|
-
const written = readingSyllables(convertPieces(dictionary, text, options));
|
|
146
|
-
const said = readingSyllables(convertPiecesUnscored(dictionary, text, {
|
|
147
|
-
...options,
|
|
148
|
-
sandhi: oppositeSandhi(options.sandhi),
|
|
149
|
-
}));
|
|
150
|
-
const spaced = readingSyllables(convertPiecesUnscored(dictionary, text, {
|
|
151
|
-
...options,
|
|
152
|
-
grouping: !(options.grouping ?? true),
|
|
153
|
-
}));
|
|
154
|
-
return written.map(({ piece, at, junction }, index) => {
|
|
155
|
-
// Sliced rather than indexed, so that a conversion somehow reporting fewer
|
|
156
|
-
// syllables than the others contributes nothing rather than needing a
|
|
157
|
-
// fallback: the caller's own conversion decides alone.
|
|
158
|
-
const alternate = said
|
|
159
|
-
.slice(index, index + 1)
|
|
160
|
-
.map((one) => one.piece.syllable);
|
|
161
|
-
const other = spaced.slice(index, index + 1).map((one) => one.junction);
|
|
162
|
-
return {
|
|
163
|
-
syllable: piece.syllable,
|
|
164
|
-
accepted: acceptedReadings([
|
|
165
|
-
piece.syllable,
|
|
166
|
-
...alternate,
|
|
167
|
-
...rejectedReadings(piece),
|
|
168
|
-
]),
|
|
169
|
-
// A hyphen is neither a break nor a join, and so allows both: it is a
|
|
170
|
-
// boundary the standard writes inside a word, and a learner rendering it
|
|
171
|
-
// as a space has not invented one.
|
|
172
|
-
acceptsBreak: junction !== "join" || other.some((one) => one !== "join"),
|
|
173
|
-
acceptsJoin: junction !== "break" || other.some((one) => one !== "break"),
|
|
174
|
-
source: piece.source,
|
|
175
|
-
at,
|
|
176
|
-
};
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Read what was typed, one syllable at a time.
|
|
181
|
-
*
|
|
182
|
-
* {@link tokenisePinyin} is what the decoder is scored with, and it is tolerant
|
|
183
|
-
* in the two ways that matter here: word spacing is discarded, and the
|
|
184
|
-
* apostrophes and hyphens inside a word are read as the syllable boundaries
|
|
185
|
-
* they are and dropped. Both are orthography rather than pronunciation.
|
|
186
|
-
*
|
|
187
|
-
* A stretch that is not pinyin at all comes back whole, and is reported as
|
|
188
|
-
* written rather than thrown away.
|
|
189
|
-
*/
|
|
190
|
-
function typedReading(typed) {
|
|
191
|
-
const { syllables, wordStarts } = tokenisePinyin(typed);
|
|
192
|
-
return syllables.map((text, at) => {
|
|
193
|
-
const syllable = readSyllable(text);
|
|
194
|
-
return {
|
|
195
|
-
text,
|
|
196
|
-
syllable,
|
|
197
|
-
base: syllable === undefined
|
|
198
|
-
? text.toLowerCase().normalize("NFC")
|
|
199
|
-
: writeSyllableSpelling(syllable),
|
|
200
|
-
tone: syllable?.tone,
|
|
201
|
-
startsWord: wordStarts.has(at),
|
|
202
|
-
};
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Match the expected syllables up with the typed ones.
|
|
207
|
-
*
|
|
208
|
-
* Aligned on the toneless spellings, for the reason
|
|
209
|
-
* {@link import("../accuracy/score.js").scoreCase} aligns on them: a syllable
|
|
210
|
-
* dropped or invented halfway through would otherwise knock everything after it
|
|
211
|
-
* out of step, and be reported as a mistake on every syllable rather than on
|
|
212
|
-
* the one.
|
|
213
|
-
*
|
|
214
|
-
* What the alignment leaves over is then paired off within each gap, which is
|
|
215
|
-
* what turns two unrelated stretches into substitutions: 银行 typed `yínxíng`
|
|
216
|
-
* anchors on `yín`, leaving one expected `háng` against one typed `xíng` — one
|
|
217
|
-
* wrong syllable rather than one missing and one invented.
|
|
218
|
-
*/
|
|
219
|
-
function pairSyllables(expected, actual) {
|
|
220
|
-
const pairs = [];
|
|
221
|
-
let held = 0;
|
|
222
|
-
let typed = 0;
|
|
223
|
-
const gap = (untilExpected, untilActual) => {
|
|
224
|
-
while (held < untilExpected || typed < untilActual) {
|
|
225
|
-
const takesExpected = held < untilExpected;
|
|
226
|
-
const takesActual = typed < untilActual;
|
|
227
|
-
pairs.push({
|
|
228
|
-
expected: takesExpected ? held : undefined,
|
|
229
|
-
actual: takesActual ? typed : undefined,
|
|
230
|
-
});
|
|
231
|
-
held += takesExpected ? 1 : 0;
|
|
232
|
-
typed += takesActual ? 1 : 0;
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
for (const anchor of alignSequences(expected, actual)) {
|
|
236
|
-
gap(anchor.expected, anchor.actual);
|
|
237
|
-
pairs.push({ expected: held, actual: typed });
|
|
238
|
-
held++;
|
|
239
|
-
typed++;
|
|
240
|
-
}
|
|
241
|
-
gap(expected.length, actual.length);
|
|
242
|
-
return pairs;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* What a typed syllable is, against what was expected in its place.
|
|
246
|
-
*
|
|
247
|
-
* The neutral tone is the one tone pinyin writes with no mark at all, so a
|
|
248
|
-
* syllable expected in it and typed without one has had its tone written
|
|
249
|
-
* correctly rather than left off.
|
|
250
|
-
*/
|
|
251
|
-
function verdictFor(expected, actual) {
|
|
252
|
-
const tones = expected.accepted.get(actual.base);
|
|
253
|
-
if (tones === undefined) {
|
|
254
|
-
return "wrong";
|
|
255
|
-
}
|
|
256
|
-
if (actual.tone === undefined) {
|
|
257
|
-
return tones.has(NEUTRAL_TONE) ? "correct" : "toneless";
|
|
258
|
-
}
|
|
259
|
-
return tones.has(actual.tone) ? "correct" : "tone";
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Where a typed syllable falls against the word boundaries.
|
|
263
|
-
*/
|
|
264
|
-
function spacingFor(expected, actual) {
|
|
265
|
-
if (actual.startsWord) {
|
|
266
|
-
return expected.acceptsBreak ? "correct" : "split";
|
|
267
|
-
}
|
|
268
|
-
return expected.acceptsJoin ? "correct" : "joined";
|
|
269
|
-
}
|
|
1
|
+
import { pairSyllables, spacingFor, verdictFor } from "./pair-syllables.js";
|
|
2
|
+
import { writeSyllableSpelling } from "../syllable/syllable.js";
|
|
3
|
+
import { expectedReading } from "./check-readings.js";
|
|
4
|
+
import { typedReading } from "./typed-reading.js";
|
|
270
5
|
/**
|
|
271
6
|
* Mark one pairing.
|
|
272
7
|
*
|
|
@@ -315,7 +50,7 @@ function checkPair(expected, actual, required) {
|
|
|
315
50
|
* and both parse, so `bei3jīng` is not a spelling mistake.
|
|
316
51
|
* - **A reading the decoder itself was unsure of.** Where another reading of
|
|
317
52
|
* the same character was there for the taking, it is accepted — see
|
|
318
|
-
* {@link rejectedReadings}. 银行 is not one of those: the word settles both
|
|
53
|
+
* {@link import("./reading-tolerance.js").rejectedReadings}. 银行 is not one of those: the word settles both
|
|
319
54
|
* syllables, so `yínxíng` really is wrong.
|
|
320
55
|
* - **Sandhi either way.** 你好 is written `nǐ hǎo` and said `ní hǎo`, and 不是
|
|
321
56
|
* is `bú shì` written and `bù shì` underneath. Both pass.
|
package/dist/grade/check.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/grade/check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/grade/check.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matching the expected syllables up with the typed ones.
|
|
3
|
+
*
|
|
4
|
+
* Aligned on the toneless spellings, so one dropped syllable is one mistake
|
|
5
|
+
* rather than a mistake on every syllable after it.
|
|
6
|
+
*/
|
|
7
|
+
import type { PinyinVerdict, SpacingVerdict } from "./check.js";
|
|
8
|
+
import type { ExpectedSyllable } from "./check-readings.js";
|
|
9
|
+
import type { TypedSyllable } from "./typed-reading.js";
|
|
10
|
+
/**
|
|
11
|
+
* Which expected syllable a typed one was matched with, where either has one.
|
|
12
|
+
*/
|
|
13
|
+
interface Pairing {
|
|
14
|
+
readonly expected: number | undefined;
|
|
15
|
+
readonly actual: number | undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Match the expected syllables up with the typed ones.
|
|
19
|
+
*
|
|
20
|
+
* Aligned on the toneless spellings, for the reason
|
|
21
|
+
* {@link import("../accuracy/score.js").scoreCase} aligns on them: a syllable
|
|
22
|
+
* dropped or invented halfway through would otherwise knock everything after it
|
|
23
|
+
* out of step, and be reported as a mistake on every syllable rather than on
|
|
24
|
+
* the one.
|
|
25
|
+
*
|
|
26
|
+
* What the alignment leaves over is then paired off within each gap, which is
|
|
27
|
+
* what turns two unrelated stretches into substitutions: 银行 typed `yínxíng`
|
|
28
|
+
* anchors on `yín`, leaving one expected `háng` against one typed `xíng` — one
|
|
29
|
+
* wrong syllable rather than one missing and one invented.
|
|
30
|
+
*/
|
|
31
|
+
export declare function pairSyllables(expected: readonly string[], actual: readonly string[]): readonly Pairing[];
|
|
32
|
+
/**
|
|
33
|
+
* What a typed syllable is, against what was expected in its place.
|
|
34
|
+
*
|
|
35
|
+
* The neutral tone is the one tone pinyin writes with no mark at all, so a
|
|
36
|
+
* syllable expected in it and typed without one has had its tone written
|
|
37
|
+
* correctly rather than left off.
|
|
38
|
+
*/
|
|
39
|
+
export declare function verdictFor(expected: ExpectedSyllable, actual: TypedSyllable): PinyinVerdict;
|
|
40
|
+
/**
|
|
41
|
+
* Where a typed syllable falls against the word boundaries.
|
|
42
|
+
*/
|
|
43
|
+
export declare function spacingFor(expected: ExpectedSyllable, actual: TypedSyllable): SpacingVerdict;
|
|
44
|
+
export {};
|
|
45
|
+
/**
|
|
46
|
+
* What is required of a check beyond reading the syllables right.
|
|
47
|
+
*/
|
|
48
|
+
//# sourceMappingURL=pair-syllables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pair-syllables.d.ts","sourceRoot":"","sources":["../../src/grade/pair-syllables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,UAAU,OAAO;IACf,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,SAAS,OAAO,EAAE,CA2BpB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,aAAa,GACpB,aAAa,CASf;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,aAAa,GACpB,cAAc,CAKhB;;AAED;;GAEG"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { alignSequences } from "../accuracy/align.js";
|
|
2
|
+
import { NEUTRAL_TONE } from "../tone/tone.js";
|
|
3
|
+
/**
|
|
4
|
+
* Match the expected syllables up with the typed ones.
|
|
5
|
+
*
|
|
6
|
+
* Aligned on the toneless spellings, for the reason
|
|
7
|
+
* {@link import("../accuracy/score.js").scoreCase} aligns on them: a syllable
|
|
8
|
+
* dropped or invented halfway through would otherwise knock everything after it
|
|
9
|
+
* out of step, and be reported as a mistake on every syllable rather than on
|
|
10
|
+
* the one.
|
|
11
|
+
*
|
|
12
|
+
* What the alignment leaves over is then paired off within each gap, which is
|
|
13
|
+
* what turns two unrelated stretches into substitutions: 银行 typed `yínxíng`
|
|
14
|
+
* anchors on `yín`, leaving one expected `háng` against one typed `xíng` — one
|
|
15
|
+
* wrong syllable rather than one missing and one invented.
|
|
16
|
+
*/
|
|
17
|
+
export function pairSyllables(expected, actual) {
|
|
18
|
+
const pairs = [];
|
|
19
|
+
let held = 0;
|
|
20
|
+
let typed = 0;
|
|
21
|
+
const gap = (untilExpected, untilActual) => {
|
|
22
|
+
while (held < untilExpected || typed < untilActual) {
|
|
23
|
+
const takesExpected = held < untilExpected;
|
|
24
|
+
const takesActual = typed < untilActual;
|
|
25
|
+
pairs.push({
|
|
26
|
+
expected: takesExpected ? held : undefined,
|
|
27
|
+
actual: takesActual ? typed : undefined,
|
|
28
|
+
});
|
|
29
|
+
held += takesExpected ? 1 : 0;
|
|
30
|
+
typed += takesActual ? 1 : 0;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
for (const anchor of alignSequences(expected, actual)) {
|
|
34
|
+
gap(anchor.expected, anchor.actual);
|
|
35
|
+
pairs.push({ expected: held, actual: typed });
|
|
36
|
+
held++;
|
|
37
|
+
typed++;
|
|
38
|
+
}
|
|
39
|
+
gap(expected.length, actual.length);
|
|
40
|
+
return pairs;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What a typed syllable is, against what was expected in its place.
|
|
44
|
+
*
|
|
45
|
+
* The neutral tone is the one tone pinyin writes with no mark at all, so a
|
|
46
|
+
* syllable expected in it and typed without one has had its tone written
|
|
47
|
+
* correctly rather than left off.
|
|
48
|
+
*/
|
|
49
|
+
export function verdictFor(expected, actual) {
|
|
50
|
+
const tones = expected.accepted.get(actual.base);
|
|
51
|
+
if (tones === undefined) {
|
|
52
|
+
return "wrong";
|
|
53
|
+
}
|
|
54
|
+
if (actual.tone === undefined) {
|
|
55
|
+
return tones.has(NEUTRAL_TONE) ? "correct" : "toneless";
|
|
56
|
+
}
|
|
57
|
+
return tones.has(actual.tone) ? "correct" : "tone";
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Where a typed syllable falls against the word boundaries.
|
|
61
|
+
*/
|
|
62
|
+
export function spacingFor(expected, actual) {
|
|
63
|
+
if (actual.startsWord) {
|
|
64
|
+
return expected.acceptsBreak ? "correct" : "split";
|
|
65
|
+
}
|
|
66
|
+
return expected.acceptsJoin ? "correct" : "joined";
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* What is required of a check beyond reading the syllables right.
|
|
70
|
+
*/
|
|
71
|
+
//# sourceMappingURL=pair-syllables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pair-syllables.js","sourceRoot":"","sources":["../../src/grade/pair-syllables.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAY/C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAC3B,QAA2B,EAC3B,MAAyB;IAEzB,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,MAAM,GAAG,GAAG,CAAC,aAAqB,EAAE,WAAmB,EAAQ,EAAE;QAC/D,OAAO,IAAI,GAAG,aAAa,IAAI,KAAK,GAAG,WAAW,EAAE,CAAC;YACnD,MAAM,aAAa,GAAG,IAAI,GAAG,aAAa,CAAC;YAC3C,MAAM,WAAW,GAAG,KAAK,GAAG,WAAW,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC;gBACT,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;gBAC1C,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aACxC,CAAC,CAAC;YACH,IAAI,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9B,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC,CAAC;IAEF,KAAK,MAAM,MAAM,IAAI,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;QACtD,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9C,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;IACV,CAAC;IACD,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,QAA0B,EAC1B,MAAqB;IAErB,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;IAC1D,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CACxB,QAA0B,EAC1B,MAAqB;IAErB,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,OAAO,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACrD,CAAC;IACD,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;AACrD,CAAC;AAED;;GAEG"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The syllables a conversion wrote, and what stands between them.
|
|
3
|
+
*
|
|
4
|
+
* The first half of reducing an answer to something comparable: a list of
|
|
5
|
+
* pieces becomes a list of syllables, each knowing where in the text it came
|
|
6
|
+
* from and whether a word began there. Nothing here weighs anything — that is
|
|
7
|
+
* `reading-tolerance.ts`, which decides what a learner may have written
|
|
8
|
+
* instead.
|
|
9
|
+
*/
|
|
10
|
+
import type { ConvertedPiece } from "../decode/convert.js";
|
|
11
|
+
import type { Syllable } from "../syllable/syllable.js";
|
|
12
|
+
/**
|
|
13
|
+
* A piece of a conversion that writes a syllable.
|
|
14
|
+
*/
|
|
15
|
+
export type ReadingPiece = ConvertedPiece & {
|
|
16
|
+
readonly syllable: Syllable;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* What a conversion writes between one syllable and the one before it.
|
|
20
|
+
*
|
|
21
|
+
* `hyphen` is its own answer rather than a kind of break because it is one:
|
|
22
|
+
* 干干净净 is `gāngān-jìngjìng`, a single orthographic word with a boundary
|
|
23
|
+
* inside it, which is why {@link import("../syllable/split.js").splitSyllables}
|
|
24
|
+
* reads a hyphen as a syllable boundary and not a word one.
|
|
25
|
+
*/
|
|
26
|
+
export type Junction = "join" | "hyphen" | "break";
|
|
27
|
+
/**
|
|
28
|
+
* One syllable of a conversion, with where it is and what precedes it.
|
|
29
|
+
*/
|
|
30
|
+
export interface ReadingSyllable {
|
|
31
|
+
readonly piece: ReadingPiece;
|
|
32
|
+
readonly at: number;
|
|
33
|
+
readonly junction: Junction;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Where each piece's source characters start, in code points.
|
|
37
|
+
*
|
|
38
|
+
* Read off the sources rather than tracked through the conversion, which works
|
|
39
|
+
* because every character of the text is named by exactly one piece — a piece
|
|
40
|
+
* naming none is either pinyin orthography the source has no trace of, such as
|
|
41
|
+
* the space between two words, or a syllable reading on into the characters the
|
|
42
|
+
* piece before it named.
|
|
43
|
+
*/
|
|
44
|
+
export declare function sourcePositions(pieces: readonly ConvertedPiece[]): readonly number[];
|
|
45
|
+
/**
|
|
46
|
+
* What a piece written between two syllables makes of the join.
|
|
47
|
+
*
|
|
48
|
+
* Only a hyphen written where the syllables would otherwise have run together
|
|
49
|
+
* is 分词连写's internal boundary; anything else — a space, punctuation, a
|
|
50
|
+
* stretch that was never Han — separates two words.
|
|
51
|
+
*/
|
|
52
|
+
export declare function junctionOver(text: string, held: Junction): Junction;
|
|
53
|
+
/**
|
|
54
|
+
* The syllables a conversion writes, with their positions and what joins them.
|
|
55
|
+
*
|
|
56
|
+
* A conversion writes its syllables as adjacent pieces within a word — the
|
|
57
|
+
* 隔音符号 is part of a syllable's own spelling rather than a piece of its own —
|
|
58
|
+
* so anything standing between two of them is a boundary, and the hyphen of
|
|
59
|
+
* 分词连写 is the one that is not a word boundary.
|
|
60
|
+
*/
|
|
61
|
+
export declare function readingSyllables(pieces: readonly ConvertedPiece[]): readonly ReadingSyllable[];
|
|
62
|
+
//# sourceMappingURL=reading-syllables.d.ts.map
|