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

loadWordsfunction

Fetches what JMdict holds for some texts, and nothing else: the pieces of the table those texts are in, about 25 kB gzipped each, so that wordsOf can then answer for them with no waiting.

A text of kana alone (かみ, カミ) is a reading and costs one piece. Any other text (紙) is a written form: its readings are found first and then their pieces, so it costs one more. Texts already in previous cost nothing. A text is made plain first (normalizeText), and one that is odd, empty or far too long is nothing to load and never an error. With romaji: true, a text of Latin letters is read as romaji (kami loads かみ). With inflected: true the dictionary forms a text could be conjugated from are loaded as well (食べなかった loads 食べる), so that inflectedOf can answer: it costs a few pieces more.

Lookups at the same moment for the same pieces share one fetch. A piece that fails is asked for once more, and then this rejects with a WordsLoadError that names it; nothing is remembered of a failure, so asking again tries again.

In safe mode, the default, nothing is fetched that holds what safe mode leaves out, and none of it is in what comes back. With mode: "unfiltered" the pieces of what was left out are fetched as well, one more for each, and the words are everything JMdict has. The consumer's block and allow lists are laid over either.

Import it

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

Definition

function loadWords(texts: string | readonly string[], options?: LoadWordsOptions): Promise<Words>

Parameters

NameTypeDescription
textsstring | readonly string[]

A reading or a written form, or a list of them.

options (optional)LoadWordsOptions

The mode, the lists, romaji, inflected, and previous words, in the same mode, to add to.

Returns

Promise<Words>

The words, ready for wordsOf.

Examples

import { loadWords, wordsOf } from "@johnmorrisdotca/jisho/words";

const words = await loadWords(["かみ", "紙"]);
console.log(wordsOf(words, "かみ").map((one) => one.written)); // ["紙", "神", "髪", ...]
console.log(wordsOf(words, "紙")[0]?.reading); // かみ
[
  '紙',   '神',
  '髪',   '加味',
  '上',   '佳味',
  'ネ申', '長官',
  '守'
]
かみ

What it prints (run when this page was built)

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