Skip to the content

Hikidashi引き出し

Era dates (和暦) and kanji numerals both ways, the dictionary forms of a conjugated word, a reading shared out over its kanji, words pulled from pasted text, and how hard a sentence is to read.

Hikidashi (引き出し) is a drawer: each tool is pulled out when it is wanted. About the name

Contents

Reference

Sentence difficulty

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

0.3 kB minified and gzipped, with everything it imports (measured with esbuild)

難しさ: how hard an example sentence is to read, so the easiest one can lead.

A character like 水 appears in thousands of example sentences, and showing whichever one a database returned first hands a first-grader a sentence built from rare name kanji. Score each sentence once (when it is added, say) and the query is a plain sort.

Two things make a sentence hard: how long it is, and the hardest character in it. Length is the honest baseline, since a short sentence is readable even when every word is new, and the hardest kanji dominates, because one unknown character stops a learner as surely as ten do.

What a kanji costs comes from the school grade or the frequency rank you hold for it (KANJIDIC2 has both). The package carries no table of its own.

Exports

NameKindWhat it is
kanjiCostfunctionThe cost of one kanji.
KanjiDifficultySourcetypeWhat your dictionary knows about a kanji, which kanjiCost turns into a cost.
kanjiInfunctionEvery kanji in the text, once each, in the order they appear.
sentenceDifficultyfunctionThe sentence's score, lowest first: its length in characters plus three times its hardest kanji.
UNKNOWN_KANJI_COSTconstantWhat a kanji costs when nothing is known about it: 20, the most any kanji costs.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hikidashi 1.1.0.