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

wordCandidatesfunction

Every substring the dictionary might know, so one question can be asked about the whole paste: look all of them up at once, and pass the ones found as known. Capped at EXTRACT_LIMITS.candidates, because a long paste of Japanese has more substrings than anybody needs to look up. Conjugated forms are offered as the dictionary forms they could come from, and a single character is never offered, since that is a kanji.

Import it

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

Also exported from: @johnmorrisdotca/hikidashi

Definition

function wordCandidates(text: string): string[]

Parameters

NameTypeDescription
textstring

The pasted text; it is cleaned and cut as sanitizePastedText does first.

Returns

string[]

Every run of two or more characters a dictionary might list, and the dictionary forms of conjugated runs, each once, at most EXTRACT_LIMITS.candidates; an empty list for text with no Japanese in it.

Examples

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

const candidates = wordCandidates("学校へ行きます");
console.log(candidates.includes("学校"), candidates.includes("行く"), candidates.length);
true true 31

What it prints (run when this page was built)

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