Skip to the content

Kotoba言葉

Load only the word lists you need, mark repeated letters correctly and play a daily or seeded word game.

Kotoba is the Japanese word for words. About the name

Contents

Reference

Marking, scores and game rules

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

8.2 kB minified and gzipped, with everything it imports (measured with 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.

Exports

NameKindWhat it is
ALPHABETSconstantThe letters each alphabet game's words are written in, as a character class.
changeWordGamefunctionThe last kana typed made small or large again (つ and っ), or given the next mark (は, ば, ぱ).
cycleMarkfunction゛゜: a kana's mark, round in turn — は → ば → ぱ → は, か → が → か, う → ゔ → う; a kana with no marked form stays.
dailyIndexfunctionWhich of count words a day gets, from 0 to count - 1.
DailyOptionstypeHow a day's word is chosen.
dailyWordfunctionThe word of a day: the same for everybody who asks about the same day of the same list.
dayKeyfunctionThe calendar day a moment falls on, as YYYY-MM-DD: in UTC unless an IANA time zone such as Asia/Tokyo is named.
DayKeytypeA day's name: four digits of year, two of month and two of day, such as 2026-10-01.
dayNumberfunctionHow many days after 1970-01-01 a day is, counting the calendar and nothing else: a day has no hours here.
decodeGuessesfunctionGuesses run together, size letters each, read back as a list; null for anything else.
decodeHiddenfunctionA hidden word read back, in lower case, or null for one that is not size letters of the language's alphabet.
encodeHiddenfunctionA hidden word as it is written down for a puzzle: in capitals.
eraseWordGamefunctionThe last thing typed taken back: romaji not yet a kana first, then the last kana or letter.
finishRomajifunctionAt Enter: what was typed, with a last "n" read as ん and any other unfinished sound dropped.
foundBonusfunctionFinding the word: 10 for every place of every guess the board gives, so it grows with the board.
GomojiLanguagetypeThe alphabet games: English, French, German, and the pop-culture English list.
guessMarksfunctionHow each place of a guess did against the hidden word.
isDayKeyfunctionWhether the text is a real calendar date written YYYY-MM-DD, from the year 0000 to 9999.
isKanaGamefunctionWhether a round is played in kana.
isSmallfunctionWhether this kana is one of the supported small forms.
KANA_COLUMNconstantWHAT A KANA WORD SCORES, won or lost, on English's scale (wordScore) so the two boards read alike.
KANA_SIZESconstantThe lengths the kana lists come in.
kanaBasefunctionA kana without its size or its mark: ぱ → は, っ → つ, ゔ → う.
kanaFamilyfunctionThe gojūon row a kana belongs to, by its base, or null for ー and anything that is no kana.
kanaFoundfunctionFound: every place plain green — the right kana, the right size, the right mark.
KanaMarktypeHOW 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):
KanaMarkedtypeOne kana guess position with its native match and size/voicing differences.
kanaScorefunctionScore kana guesses using exact, elsewhere and same-family matches plus found and speed bonuses.
KanaScoretypeThe word-score components with the additional same-kana-family column component.
kanaTonefunctionWhich mark a kana carries: none, ゛ or ゜.
KanaWordstypeA kana list, read.
KEYBOARD_ROWSconstantTHE 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.
keyMarksfunctionThe best mark each letter has earned across the guesses, for colouring a keyboard: a hit beats near beats miss.
KOTOBA_STRINGSconstantEvery string, in both languages.
kotobaLanguagefunctionThe language a person asked for, by en or ja or a tag that begins with one: English for anything else.
kotobaSayfunctionA string with its braces filled in from values; a brace with no value is left as it is.
KotobaStringstypeThe names of the strings.
LanguagetypeThe languages Kotoba speaks.
LetterMarktypeHow a guessed letter did: in its place, in the word elsewhere, or not in it.
LONG_BARconstantThe long-vowel bar, a character of its own.
markGuessfunctionEach letter of a guess marked against the hidden word, counting a letter only as often as the word holds it.
markKanaGuessfunctionA guess coloured against the word, place by place.
PackedtypeA 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.
PlaceMarktypeOne place of a marked guess: how it did, and for kana whether its size or mark is wrong.
readRomajifunctionWhat has been typed, as kana, and what is still being typed.
readWordListsfunctionOne length of a list read into words, or null for a length the list does not have.
startWordGamefunctionA new round: nothing guessed, nothing typed.
submitWordGamefunctionThe guess being typed sent in, now being the time in milliseconds.
toggleSizefunction小: a kana made small, or large again (つ ⇄ っ); one with no small form stays as it is.
typeWordGamefunctionOne key typed, now being the time in milliseconds (the first key starts the clock).
unpackfunctionA packed kana list read into its words, size kana each.
VERSIONconstantThe package's version.
WORD_GAME_ROWSconstantThe guesses a round gives unless said.
WORD_SCOREconstantWHAT A GOMOJI WORD SCORES, won or lost.
WordDatatypeAn 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.
WordGametypeA round.
wordGameKeysfunctionThe 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.
WordGameLanguagetypeThe languages a round is played in: the alphabet ones and Japanese kana.
WordGameRefusaltypeWhy a guess was not taken: it was too short, or the list does not have the word.
WordGameStatustypeHow a round stands: still being played, found, or out of guesses.
WordGameSubmittypeA guess sent in: the round after it, and why the guess was not taken, if it was not.
WordGameWordstypeThe words a round may be guessed from.
WordListLanguagetypeThe languages with a dictionary of their own: English, French and German.
WordListstypeOne length of an alphabet list, read: the easy answers, every answer, and the words that may be guessed.
wordScorefunctionrows is how many guesses the puzzle gives (guessesFor), which sets every weight.
WordScoretypeThe placed-letter, elsewhere-letter, found-word and speed components and their total.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kotoba 1.2.0.