リファレンス
判定・得点・ゲームのルール
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. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。