本文へ移動

Kotoba言葉

必要な単語一覧だけを読み込み、重複する文字を正しく判定し、日替わりやシード付きの単語ゲームを遊べます。

「Kotoba」は「言葉」です。 名前について(英語)

目次

リファレンス

判定・得点・ゲームのルール

import { … } from "@johnmorrisdotca/kotoba";

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

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

Kotoba: word lists and the rules of word games, in English, French, German and Japanese. The lists themselves are entry points of their own, so a page loads only what it plays: see the README.

エクスポート

名前種類概要
ALPHABETS定数The letters each alphabet game's words are written in, as a character class.
changeWordGame関数The last kana typed made small or large again (つ and っ), or given the next mark (は, ば, ぱ).
cycleMark関数゛゜: a kana's mark, round in turn — は → ば → ぱ → は, か → が → か, う → ゔ → う; a kana with no marked form stays.
dailyIndex関数Which of count words a day gets, from 0 to count - 1.
DailyOptions型How a day's word is chosen.
dailyWord関数The word of a day: the same for everybody who asks about the same day of the same list.
dayKey関数The calendar day a moment falls on, as YYYY-MM-DD: in UTC unless an IANA time zone such as Asia/Tokyo is named.
DayKey型A day's name: four digits of year, two of month and two of day, such as 2026-10-01.
dayNumber関数How many days after 1970-01-01 a day is, counting the calendar and nothing else: a day has no hours here.
decodeGuesses関数Guesses run together, size letters each, read back as a list; null for anything else.
decodeHidden関数A hidden word read back, in lower case, or null for one that is not size letters of the language's alphabet.
encodeHidden関数A hidden word as it is written down for a puzzle: in capitals.
eraseWordGame関数The last thing typed taken back: romaji not yet a kana first, then the last kana or letter.
finishRomaji関数At Enter: what was typed, with a last "n" read as ん and any other unfinished sound dropped.
foundBonus関数Finding the word: 10 for every place of every guess the board gives, so it grows with the board.
GomojiLanguage型The alphabet games: English, French, German, and the pop-culture English list.
guessMarks関数How each place of a guess did against the hidden word.
isDayKey関数Whether the text is a real calendar date written YYYY-MM-DD, from the year 0000 to 9999.
isKanaGame関数Whether a round is played in kana.
isSmall関数Whether this kana is one of the supported small forms.
KANA_COLUMN定数WHAT A KANA WORD SCORES, won or lost, on English's scale (wordScore) so the two boards read alike.
KANA_SIZES定数The lengths the kana lists come in.
kanaBase関数A kana without its size or its mark: ぱ → は, っ → つ, ゔ → う.
kanaFamily関数The gojūon row a kana belongs to, by its base, or null for ー and anything that is no kana.
kanaFound関数Found: every place plain green — the right kana, the right size, the right mark.
KanaMark型HOW A KANA GUESS IS COLOURED, by John's rules for Gomoji in kana (2026-09-25; the table is in docs/plans/other/WORD-04-kana.md):
KanaMarked型One kana guess position with its native match and size/voicing differences.
kanaScore関数Score kana guesses using exact, elsewhere and same-family matches plus found and speed bonuses.
KanaScore型The word-score components with the additional same-kana-family column component.
kanaTone関数Which mark a kana carries: none, ゛ or ゜.
KanaWords型A kana list, read.
KEYBOARD_ROWS定数THE PHYSICAL KEYBOARD DRAWN UNDER A GOMOJI GRID, by language: QWERTY for English, AZERTY for French (the same 26 plain letters English's keys carry, arranged the way a French keyboard is), and QWERTZ for German, with Ä, Ö and Ü carried as keys of their own — German's letters, not English's plus a fold.
keyMarks関数The best mark each letter has earned across the guesses, for colouring a keyboard: a hit beats near beats miss.
KOTOBA_STRINGS定数Every string, in both languages.
kotobaLanguage関数The language a person asked for, by en or ja or a tag that begins with one: English for anything else.
kotobaSay関数A string with its braces filled in from values; a brace with no value is left as it is.
KotobaStrings型The names of the strings.
Language型The languages Kotoba speaks.
LetterMark型How a guessed letter did: in its place, in the word elsewhere, or not in it.
LONG_BAR定数The long-vowel bar, a character of its own.
markGuess関数Each letter of a guess marked against the hidden word, counting a letter only as often as the word holds it.
markKanaGuess関数A guess coloured against the word, place by place.
Packed型A kana list as its entry point exports it: the JMdict release, an alphabet of kana and one character a kana for each, and the three lists written in those characters.
PlaceMark型One place of a marked guess: how it did, and for kana whether its size or mark is wrong.
readRomaji関数What has been typed, as kana, and what is still being typed.
readWordLists関数One length of a list read into words, or null for a length the list does not have.
startWordGame関数A new round: nothing guessed, nothing typed.
submitWordGame関数The guess being typed sent in, now being the time in milliseconds.
toggleSize関数小: a kana made small, or large again (つ ⇄ っ); one with no small form stays as it is.
typeWordGame関数One key typed, now being the time in milliseconds (the first key starts the clock).
unpack関数A packed kana list read into its words, size kana each.
VERSION定数The package's version.
WORD_GAME_ROWS定数The guesses a round gives unless said.
WORD_SCORE定数WHAT A GOMOJI WORD SCORES, won or lost.
WordData型An alphabet list as its entry point exports it: for each length, the easy answers, all the answers and every word that may be guessed, each a run of words between spaces.
WordGame型A round.
wordGameKeys関数The keys a round accepts, by the character each types: the letters of the language's keyboard, and for kana the letters of romaji and the long-vowel bar.
WordGameLanguage型The languages a round is played in: the alphabet ones and Japanese kana.
WordGameRefusal型Why a guess was not taken: it was too short, or the list does not have the word.
WordGameStatus型How a round stands: still being played, found, or out of guesses.
WordGameSubmit型A guess sent in: the round after it, and why the guess was not taken, if it was not.
WordGameWords型The words a round may be guessed from.
WordListLanguage型The languages with a dictionary of their own: English, French and German.
WordLists型One length of an alphabet list, read: the easy answers, every answer, and the words that may be guessed.
wordScore関数rows is how many guesses the puzzle gives (guessesFor), which sets every weight.
WordScore型The placed-letter, elsewhere-letter, found-word and speed components and their total.

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

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