javascript list of english words for a game
Solution 1
You can use Aspell English dictionary.
Aspell English dictionary is availabe at: ftp://ftp.gnu.org/gnu/aspell/dict/0index.html.
To dump world list from the Aspell dictionary checkout:
- https://superuser.com/questions/137957/how-to-convert-aspell-dictionary-to-simple-list-of-words
- http://www.commandlinefu.com/commands/view/10619/dump-an-aspell-dictionary-as-a-word-list
- http://aspell.net/man-html/Dumping-the-Contents-of-the-Word-List.html
The command to dump English list of words should look something like:
aspell -d en dump master | aspell -l en expand > words.txt
Solution 2
with node you can install random-words
npm install random-words
import it and you're done:
var randomWords = require('random-words');
console.log(randomWords());
Solution 3
The wordlist for Firefox spellchecking seems to come from this repository: https://github.com/marcoagpinto/aoo-mozilla-en-dict. So you could download it there to get a word list.
You can also install the dictionary as addon (https://addons.mozilla.org/en-GB/firefox/language-tools/) but I don't know if or how the dictionary-addons can be accessed with JavaScript directly from inside the browser.
Solution 4
Easiest solution that I found is getting a text or JSON file from anywhere(on web) which contains all the English words(not meanings like in dictionary). I got it from this repository, this contains a text file and a JSON file.
You can easily read data from JSON file using javascript or other programming languages.
Solution 5
Was looking for a simple JSON endpoint I could use for a workbook - wound up uploading one to github:
Comments
-
Adam Meyer almost 2 years
I'm making a simple JS game that needs a list of English dictionary words. Will I need to build the list myself, or is it possible to access the system's or browser's spell-check dictionary - or maybe there's another solution?
-
jfunk over 2 yearsWorth noting that Random Words includes a very small subset of the English language
-
Adam Grant over 2 yearsCareful, there are some naughty and rather offensive words in here. Depending on their use, they may not be words you want appearing in your product.