本文へ移動

Hikidashi引き出し

和暦と漢数字の相互変換、活用した語の辞書形、漢字への読みの割り当て、貼り付けた文からの単語の抽出、文の難しさ。日本語のテキストを扱う小さな道具を集めた引き出しです。

「引き出し」という名前は、道具が一つずつしまってあり、必要なときに取り出して使える、という意味です。 名前について(英語)

目次

リファレンス

読みの割り当て

import { … } from "@johnmorrisdotca/hikidashi/align";

最小化と gzip 圧縮をしたサイズは 1.1 kB(読み込むものをすべて含み、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.

エクスポート

名前種類概要
ALIGN_LIMITS定数What segmentWord will work on: a word of up to 64 characters and a reading of up to 256.
buildKanjiTest関数The test: words to write in kanji, then different words to read.
hiraganaToKatakana関数Hiragana written as katakana: ひらがな to ヒラガナ.
kanjiAsWord関数A kanji on its own, as a word a test can ask.
KanjiTest型A test: words to write in kanji from their readings, then different words to read.
KanjiTestQuestion型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関数Katakana written as hiragana: カタカナ to かたかな.
ReadWord型A word and its reading in hiragana: what buildKanjiTest takes a list of, and what kanjiAsWord makes.
SEGMENT_KINDS定数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型One kind of run: "kanji", "kana" or "okurigana", the values of SEGMENT_KINDS.
segmentWord関数A word cut into its kanji and its kana, each kanji run with its share of the reading.
WordSegment型One run of a word, and its share of the reading in hiragana: what segmentWord cuts a word into.

ソースを見るGitHub で編集@johnmorrisdotca/hikidashi 1.1.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。