What it does
The pack carries the Common English Lexicon (CEL), a list made for word games: 69,223 common English words of 2 to 45 letters, chosen by how often they appear in books, articles and searches, with no proper nouns. A content rating leaves out its slurs, strong swearing and explicit terms by default, and a family rating the milder ones too. The words are inside the pack, front-coded by length, so there is nothing to fetch: they work offline, in headless tests and in replays, and the same seed always picks the same word. Each length is decoded the first time something asks for it.
A WordList keeps its words lower case, grouped by length and sorted, so a lookup is a binary search in one group and
a search walks only the lengths it can match. One query object narrows by length, start, end, a run of letters, a
pattern such as c?a[^s]e, the letters a rack can spell, letters a word must use or must not, and any test of your
own. The same list answers whether anything starts with a prefix (what a grid solver asks before going a letter
deeper), lists anagrams, and finds the words within a few edits of a typo, nearest first.
Every word you pick comes back as a Word, which answers the questions a game asks of its letters: what is at the
third position, is the fourth letter an E, how many Ts it has, what comes next after a partly traced word, and whether
its letters can make another word. Lists of your own, from an array, text or a file the loader fetched, work exactly
like the lexicon.
Features
- The Common English Lexicon — 69,223 words of 2 to 45 letters in the pack, about 170 KB gzipped, decoded a length at a time.
- One query for every search — length,
startsWith,endsWith,contains,pattern,from,only,uses,without,excludeand your ownwhere, in any combination. - Patterns —
?,.or_for any letter,[abc]for any of those and[^abc]for any but those. - Rack and wheel search —
from: 'listen'finds every word those letters spell, each letter used once. - Prefixes and anagrams —
isPrefix,completionsandanagramsfor grid solvers, traces and anagram puzzles. - Did you mean —
nearandclosestrank words by edits, counting a swap of two neighbouring letters as one. - Seeded picks —
game.words.pickandsampledraw from the game's random source, so a seed replays the choice. - Words with answers — a
Wordgivesat,is,count,positions,next,canMakeandisAnagramOf. - Your own lists —
createWordListfrom an array or text,game.words.loadedfrom a fetched file, with names such as "T. Rex" normalised to letters. - Content ratings — slurs and strong swearing left out by default, milder words too with
rating: 'family'. - Letter frequency — each list reports how often each letter appears, for drawing playable letters.
Good for
- Hidden-word guessing games, through
word-guess, or your own rules on top ofpickandhas. - Letter grids and letter wheels, through
letter-gridandletter-wheel, which solve their boards with it. - Word searches filled with random words, by passing a search's results to
word-searchas its pool. - Spelling, typing and hangman games that check a word and pick the next one.
- Crossword and anagram helpers, with patterns, racks and anagrams.
- Themed word games, with a list of your own in place of the dictionary.
Make it yours
The manifest sets the game's own list: min and max lengths, words to include (your game's slang or names it
allows) and words to exclude. game.words.english gives the lexicon narrowed differently for another part of the
game, and every list can be filtered, extended or trimmed into a new one.
Two different uses: a five-letter guessing game composes the pack with min and max of 5 and draws its daily
answer with pick; a children's spelling game composes it with a blocklist in exclude, and checks each typed word
with has, offering closest when it is misspelt. A themed game skips the lexicon and makes a twelve-word list of
dinosaurs with createWordList.
A quick look
Picking a word and asking about its letters:
game.words.has('Crane'); // true: case does not matter
const target = game.words.pick({ length: 5 }); // a Word, from the game's random source
target.at(0); target.is(2, 'a'); target.count('e');
game.words.sample(12, { min: 4, max: 8 }); // twelve different words
game.words.find({ pattern: 'c?a[^s]e' }); // every match, shortest first then alphabetical
game.words.lexicon.isPrefix('xylo'); // does any word start with it?
Works with
letter-tiles— shows letters as tiles a player drags across, for any word game of your own.word-guess— hidden-word guessing rules whose answers and allowed guesses come from these lists.letter-grid— word hunts on a grid of letter tiles, solved with these lists' prefix checks.letter-wheel— letter wheel levels whose words come from the search for what a rack spells.word-search— takes plain strings, so a search's results become a random puzzle's pool.
Good to know
- English only, letters a to z. Accents are taken off; words with digits or other scripts are refused.
- It is a list of words, not a dictionary: there are no definitions, frequencies or difficulty levels.
- The ratings are a curated list of the lexicon's own words, not a filter for anything players type;
excludetakes out anything else a game does not want. - The whole lexicon is in the game's bundle, about 390 KB before compression, whichever lengths the game uses.
- The words are the Common English Lexicon by Eric Smith and Kenji Matsumoto, under the MIT licence, which travels with the pack.






