本文へ移動

Jisho辞書

JMdictの単語を読み、表記、英語の意味、含まれる漢字、ローマ字から引け、必要な小さなチャンクだけを取得します。初期値はセーフモードで、各語義にはJMdictの印が付き、「フィルターなし」も選べます。2,999字の漢字の学年、JLPTレベル、読み、意味、形の似た漢字の組も収め、表ごとに独立したエントリポイントがあります。

「Jisho」は「辞書」のローマ字表記です。日本語の単語と漢字を収めています。 名前について(英語)

目次

リファレンス · 読み、表記、英語の意味、漢字、ローマ字から単語を引く

loadWords関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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 { loadWords } from "@johnmorrisdotca/jisho/words";

定義

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

引数

名前型説明
textsstring | readonly string[]

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

options (省略可)LoadWordsOptions

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

戻り値

Promise<Words>

The words, ready for wordsOf.

例

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); // かみ
[
  '紙',   '神',
  '髪',   '加味',
  '上',   '佳味',
  'ネ申', '長官',
  '守'
]
かみ

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/jisho 2.11.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。