Reference · Sentence difficulty
kanjiCostfunction
The cost of one kanji.
School grades are the scale a family already understands, so grades 1 to 6 cost their own number.
Grade 8 is the rest of jōyō, taught in secondary school, and 9 and 10 are the name kanji, which a
learner meets late if at all. Ungraded characters fall back to how common they are, since a frequent
character is easier than a rare one whatever any curriculum says. A kanji nothing is known about
costs UNKNOWN_KANJI_COST, the most.
Import it
import { kanjiCost } from "@johnmorrisdotca/hikidashi/difficulty";
Also exported from: @johnmorrisdotca/hikidashi
Definition
function kanjiCost(entry: KanjiDifficultySource | null | undefined): number
Parameters
| Name | Type | Description |
|---|---|---|
entry | KanjiDifficultySource | null | undefined | What you hold about the kanji; null or undefined when you hold nothing. |
Returns
number
The cost: 1 to 6 for grades 1 to 6, 9 for grade 8, 14 for name kanji (9 and 10), 10 to 18 by frequency
for an ungraded kanji, and 20 (UNKNOWN_KANJI_COST) when nothing is known.
Examples
import { kanjiCost } from "@johnmorrisdotca/hikidashi/difficulty";
console.log(kanjiCost({ grade: 3, frequencyRank: 969 }), kanjiCost({ grade: 8, frequencyRank: 1500 }));
console.log(kanjiCost({ grade: null, frequencyRank: 2400 }), kanjiCost(undefined));3 9
16 20What it prints (run when this page was built)