本文へ移動

Hikidashi引き出し

和暦と漢数字の相互変換、活用した語の辞書形、漢字への読みの割り当て、貼り付けた文からの単語の抽出、文の難しさ。日本語のテキストを扱う小さな道具を集めた引き出しです。

「引き出し」という名前は、道具が一つずつしまってあり、必要なときに取り出して使える、という意味です。 名前について(英語)

目次

リファレンス

辞書形

import { … } from "@johnmorrisdotca/hikidashi/deinflect";

最小化と gzip 圧縮をしたサイズは 1.9 kB(読み込むものをすべて含み、esbuild で計測)

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

活用: the dictionary form a conjugated word was written from.

A sentence writes its verbs and adjectives conjugated: 行きます, 食べました, 待って, 高くて. A dictionary lists them as 行く, 食べる, 待つ and 高い. Look a sentence up as it is written and 先生と学校へ行きます finds 行き, a noun meaning "bound for" that is also the stem of the verb, instead of 行く.

This walks a written form back through its endings, one at a time, the way a learner does: 行きませんでした is the polite negative past of 行く; 食べなかった is the past of 食べない, which is the negative of 食べる. Every answer says which kind of word it would have to be, and a caller keeps only the ones its dictionary confirms are that kind, so 行き is never taken for a verb stem when nothing follows it and a noun ending in る is never taken for a verb.

There is deliberately no rule that reads a bare stem as its verb. 東京行き is a noun, and 行き alone is only ever a verb when an ending follows it, which is exactly when a longer rule matches.

Covered: godan and ichidan verbs, い adjectives, and the two irregular verbs する and 来る, in the polite, negative, past, te, conditional, volitional, passive, causative, potential and "wanting" forms and chains of them. Not covered: the imperative, keigo verbs, and な adjectives (which do not conjugate onto themselves).

エクスポート

名前種類概要
Deinflection型One answer of dictionaryForms: a dictionary form the written word could come from, and the kind of word it would have to be for that to be true.
dictionaryForms関数Every dictionary form written could be a conjugation of, with the kind of word it would have to be.
followsAsVerbStem関数Whether following opens with an ending that only a verb's stem takes (ます, ました, ません, ましょう, まして, たい, なさい), so that the word before it is being written as a stem.
LONGEST_ENDING定数The longest ending, in characters, that any rule strips, so a caller matching words in running text knows how far past a dictionary word to look for its conjugation.
WORD_CLASSES定数The kinds of word a conjugated form can come from, each named by itself: godan and ichidan verbs, iAdjective, and the two irregular verbs suru (する) and kuru (来る).
WordClass型One kind of word: "godan", "ichidan", "iAdjective", "suru" or "kuru", the values of WORD_CLASSES.
wordClassesOf関数The kinds of word a dictionary entry is, from the parts of speech it lists, so a conjugated form is only taken for a verb or an adjective the dictionary says is one.

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

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