Reference · Look words up by reading, written form, English meaning, kanji or romaji
suggestWordsfunction
The common words nearest to a text that may have a typo in it, the exact ones first and then those one slip away, the commonest first.
kamii suggests かみ, tabemsu suggests 食べます and にほんこ suggests 日本語; a text of kanji suggests nothing, because a kanji is not
a slip away from another. It covers the 26,000 common words, from one table of about 800 kB gzipped that it fetches once (a second
in unfiltered mode), and it is for a lookup that found nothing, not for every lookup.
Import it
import { suggestWords } from "@johnmorrisdotca/jisho/words";
Definition
function suggestWords(text: string, options?: WordsOptions & { readonly limit?: number; }): Promise<Suggestion[]>
Parameters
| Name | Type | Description |
|---|---|---|
text | string | Romaji or kana, with a slip in it or not. |
options (optional) | WordsOptions & { readonly limit?: number; } |
|
Returns
Promise<Suggestion[]>
The suggestions; none for a text that is not romaji or kana, that is empty, or longer than 40 characters.
Examples
import { suggestWords } from "@johnmorrisdotca/jisho/words";
const found = await suggestWords("tabemsu");
console.log(found.map((one) => one.word.written)); // ["食べます", ...][]What it prints (run when this page was built)