Reference
Reading alignment
import { … } from "@johnmorrisdotca/hikidashi/align";
1.1 kB minified and gzipped, with everything it imports (measured with esbuild)
読みの割り当て: a word's reading shared out over its kanji, the way a school's かん字テスト sets it.
A reading beside empty squares, the kanji written in the squares and the okurigana in brackets under them. 食べる read たべる is 食 (た) and べる; 形が合う read かたちがあう is 形 (かたち), が, 合 (あ), う. The kana a word is written with are anchors in its reading, which is what lets the rest be shared out between the kanji. This is the part a worksheet, a flashcard that blanks the kanji, or a ruby annotator needs, with nothing to look up.
A test has a writing half (see the reading, write the kanji) and a reading half (see the kanji, write
the reading), drawn from the same words. buildKanjiTest makes both from a list, the same test for
the same seed.
Exports
| Name | Kind | What it is |
|---|---|---|
ALIGN_LIMITS | constant | What segmentWord will work on: a word of up to 64 characters and a reading of up to 256. |
buildKanjiTest | function | The test: words to write in kanji, then different words to read. |
hiraganaToKatakana | function | Hiragana written as katakana: ひらがな to ヒラガナ. |
kanjiAsWord | function | A kanji on its own, as a word a test can ask. |
KanjiTest | type | A test: words to write in kanji from their readings, then different words to read. |
KanjiTestQuestion | type | One question of a test: the word, its reading, and the word cut into its segments, ready to be drawn as squares with the okurigana in brackets. |
katakanaToHiragana | function | Katakana written as hiragana: カタカナ to かたかな. |
ReadWord | type | A word and its reading in hiragana: what buildKanjiTest takes a list of, and what kanjiAsWord makes. |
SEGMENT_KINDS | constant | What a run of a word is: kanji with their part of the reading, kana inside the word, or the kana that end it (okurigana). |
SegmentKind | type | One kind of run: "kanji", "kana" or "okurigana", the values of SEGMENT_KINDS. |
segmentWord | function | A word cut into its kanji and its kana, each kanji run with its share of the reading. |
WordSegment | type | One run of a word, and its share of the reading in hiragana: what segmentWord cuts a word into. |