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 · Reading alignment

buildKanjiTestfunction

The test: words to write in kanji, then different words to read.

The seed decides which words and in what order, so the test on paper is the test that was on screen and a link sent to somebody is the same test. Each word is asked once, and a word whose reading does not fit it (segmentWord says null) is left out. A list too short for two halves of different words asks its words both ways rather than leave the second half short.

Import it

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

Also exported from: @johnmorrisdotca/hikidashi

Definition

function buildKanjiTest(pool: readonly ReadWord[], { seed, count }: { seed: number; count: number; }): KanjiTest

Parameters

NameTypeDescription
poolreadonly ReadWord[]

The words to draw from, each with its reading.

options{ seed: number; count: number; }

seed decides which words and in what order; count is how many questions each half has (below one asks nothing).

Returns

KanjiTest

The writing half and the reading half, each up to count questions; both empty when no word of the pool fits its reading.

Examples

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

const pool = [
  { word: "食べる", reading: "たべる" }, { word: "水", reading: "みず" },
  { word: "学校", reading: "がっこう" }, { word: "形が合う", reading: "かたちがあう" },
];
const test = buildKanjiTest(pool, { seed: 7, count: 2 });
console.log(test.writing.map((one) => one.word), test.reading.map((one) => one.word));
console.log(JSON.stringify(buildKanjiTest(pool, { seed: 7, count: 2 })) === JSON.stringify(test));
[ '学校', '水' ] [ '形が合う', '食べる' ]
true

What it prints (run when this page was built)

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