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
| Name | Type | Description |
|---|---|---|
text | string | The pasted text; it is cleaned and cut as |
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 31What it prints (run when this page was built)