wordCandidates関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { wordCandidates } from "@johnmorrisdotca/hikidashi/extract";
ほかのエクスポート元: @johnmorrisdotca/hikidashi
定義
function wordCandidates(text: string): string[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
text | string | The pasted text; it is cleaned and cut as |
戻り値
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.
例
import { wordCandidates } from "@johnmorrisdotca/hikidashi/extract";
const candidates = wordCandidates("学校へ行きます");
console.log(candidates.includes("学校"), candidates.includes("行く"), candidates.length);true true 31出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。