Skip to the content

Jisho辞書

The words of JMdict looked up by reading, written form, English meaning, a kanji in them or romaji, in small pieces fetched as needed, safe by default or unfiltered with every sense's marks, and the school grades, JLPT levels, readings, meanings and look-alike pairs of 2,999 kanji, each table an entry point of its own.

Jisho is the Japanese word 辞書 for a dictionary: this one holds Japanese words and kanji. About the name

Contents

Reference · Look words up by reading, written form, English meaning, kanji or romaji

readTextfunction

Reads a text: it is cut into words by taking, from each place, the longest stretch that the dictionary has a word for, either as it stands or as a conjugated form (食べなかった is 食べる). Each word comes with its furigana, its meaning, the hardest JLPT level among its kanji, and each kanji's grade and level; a stretch of Japanese that no word fits is unknown and is listed; spaces, punctuation, Latin letters and digits are kept as other. Nothing but Jisho's own pieces is fetched, about 25 kB gzipped each, as the stretches need them (a few for each word), and a piece is kept for the next one, so a text costs the pieces of its words once.

It picks the longest stretch, not the best reading of a sentence: there is no model of grammar, so a rare word that happens to be longer can win, and a name is unknown or cut into small words. Among equal stretches the commonest word is taken, and the others are in alternatives. In safe mode a word the mode leaves out is not found, so its text is unknown.

Import it

import { readText } from "@johnmorrisdotca/jisho/words";

Definition

function readText(text: string, options?: WordsOptions): Promise<ReadResult>

Parameters

NameTypeDescription
textstring

Japanese text, up to MAX_READ_LENGTH characters.

options (optional)WordsOptions

The mode, the block and allow lists, as for loadWords.

Returns

Promise<ReadResult>

The pieces, the unknown stretches and the JMdict release.

Examples

import { readText } from "@johnmorrisdotca/jisho/words";

const result = await readText("私は寿司を食べなかった。");
console.log(result.tokens.map((token) => token.text)); // ["私", "は", "寿司", "を", "食べなかった", "。"]
[ '私', 'は', '寿司', 'を', '食べなかった', '。' ]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/jisho 2.11.0.