buildKanjiTest関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { buildKanjiTest } from "@johnmorrisdotca/hikidashi/align";
ほかのエクスポート元: @johnmorrisdotca/hikidashi
定義
function buildKanjiTest(pool: readonly ReadWord[], { seed, count }: { seed: number; count: number; }): KanjiTest
引数
| 名前 | 型 | 説明 |
|---|---|---|
pool | readonly ReadWord[] | The words to draw from, each with its reading. |
options | { seed: number; count: number; } |
|
戻り値
KanjiTest
The writing half and the reading half, each up to count questions; both empty when no word of the pool
fits its reading.
例
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出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。