WordSegmenttype
One run of a word, and its share of the reading in hiragana: what segmentWord cuts a word into.
Import it
import type { WordSegment } from "@johnmorrisdotca/hikidashi/align";
Also exported from: @johnmorrisdotca/hikidashi
Definition
type WordSegment = {
text: string;
kind: SegmentKind;
reading: string;
};
Members
| Name | Type | Description |
|---|---|---|
text | string | The run as the word writes it: one or more kanji, or kana. |
kind | SegmentKind | Kanji, kana inside the word, or okurigana at its end. |
reading | string | The run's share of the reading, in hiragana. |
Examples
import { segmentWord, type WordSegment } from "@johnmorrisdotca/hikidashi/align";
const first: WordSegment | undefined = segmentWord("食べる", "たべる")?.[0];
console.log(first);{ text: '食', reading: 'た', kind: 'kanji' }What it prints (run when this page was built)