@rahulmrx/game-ready-dictionary
v1.0.8
Published
Open-source, pre-compiled Trie-based dictionary for web-based word games.
Maintainers
Readme
📚 Game-Ready Dictionary
A high-performance, multi-tiered dictionary and Trie-based validation engine designed specifically for modern web-based word games. This repository provides pre-compiled assets across three complexity tiers, optimized for instant integration into high-performance game loops.
⚖️ Dual-License Architecture
- Codebase (MIT License): All source code and the Trie implementation are licensed under the MIT License.
- Dictionary Data (Public Domain / UNLICENSE): The compiled word lists and Trie JSON files are dedicated to the Public Domain.
🚀 Complexity Tiers
We provide three distinct tiers to balance vocabulary depth with asset size:
| Tier | Size | Description | Best For | | :--- | :--- | :--- | :--- | | Small | ~7,000 words | Intersection of 12Dicts and Top 10k Google English list. | Casual mobile games, ultra-fast loading. | | Medium | ~60,000 words | The full 12Dicts (5desk) base list, cleaned and filtered. | Standard crosswords, word search, roguelites. | | Large | ~182,000 words | The ENABLE1 word list + 12Dicts (superset). | Professional-grade validation, deep-strategy games. | | Dialects | US / UK | SCOWL (American/British) specialized word lists. | Games requiring dialect-specific spelling (color vs colour). |
📦 Output Formats (Medium Tier)
The Medium tier is exported in three formats to suit different development needs:
data/medium_array.json/data/large_array.json: A standard alphabetical array of all valid words.data/medium_by_length.json/data/large_by_length.json: An object keyed by word length.data/medium_trie.json/data/large_trie.json: A nested JSON Trie structure optimized for $O(m)$ lookups.
⚡ High-Performance Usage
The dictionary is provided as a pre-compiled Trie, allowing for $O(m)$ lookup time.
Quick Start (Trie)
import { TrieEngine } from 'game-ready-dictionary';
import trieData from 'game-ready-dictionary/data/medium_trie.json';
const trie = new TrieEngine(trieData);
if (trie.validate('apple')) {
console.log('Valid word!');
}Dialect Support (US vs UK)
You can specifically import American or British English to handle spelling variations (e.g., color vs colour):
import { TrieEngine } from 'game-ready-dictionary';
import usData from 'game-ready-dictionary/us';
import ukData from 'game-ready-dictionary/uk';
const usTrie = new TrieEngine(usData);
const ukTrie = new TrieEngine(ukData);
console.log(usTrie.validate('color')); // true
console.log(ukTrie.validate('color')); // false🛠️ Data Pipeline
You can regenerate the dictionary assets or use your own word lists via our Python pipeline:
pip install requests better_profanity
python3 pipeline.pyThe pipeline automatically:
- Converts to lowercase.
- Drops words with hyphens, apostrophes, or digits.
- Removes offensive terms via
better_profanity. - Strips non-dictionary brand names from our
TRADEMARK_BLOCKLIST.
⭐ Support the Project
If this dictionary saved you development hours or helped you ship your game, please consider starring the repository.
Built with ❤️ for the game dev community.
