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 · Pasted text

extractFromTextfunction

The words and kanji a paste comes to: the words known lists, longest match first, and every kanji in the text.

Both, rather than one or the other. A handout of vocabulary is wanted as words; the same handout is also the kanji a learner has to write, and which of the two somebody meant is not for this to decide. Show the result first, and let them take out what they did not want.

Import it

import { extractFromText } from "@johnmorrisdotca/hikidashi/extract";

Also exported from: @johnmorrisdotca/hikidashi

Definition

function extractFromText({ text, known }: ExtractInput): ExtractResult

Parameters

NameTypeDescription
inputExtractInput

The text, and known, the words your dictionary confirmed (a Map from word to its kinds).

Returns

ExtractResult

The words known lists, in dictionary form and in the order they first appear, every kanji in the text, and counts of what the paste held. With no known, words is empty.

Examples

import type { WordClass } from "@johnmorrisdotca/hikidashi/deinflect";
import { extractFromText } from "@johnmorrisdotca/hikidashi/extract";

const known = new Map<string, WordClass[]>([["先生", []], ["学校", []], ["行く", ["godan"]], ["行き", []]]);
console.log(extractFromText({ text: "先生と学校へ行きます", known }).words);
console.log(extractFromText({ text: "東京行きの電車", known }).words);
[ '先生', '学校', '行く' ]
[ '行き' ]

What it prints (run when this page was built)

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