english-words-py

raw JSON →
2.0.2 verified Mon Apr 27 auth: no python

A Python library to generate sets of English words by combining different word lists. Version 2.0.2 provides access to common, small, and large word sets; simple API with get_words_set().

pip install english-words
error 'module' object has no attribute 'english_words'
cause Importing from the top-level module as if it were the old API (e.g., `import english_words; english_words.english_words`).
fix
Use from english_words import get_words_set instead.
error AttributeError: module 'english_words' has no attribute 'get_words_set'
cause Old version (<2.0.0) installed; upgrade to get function-based API.
fix
Run pip install --upgrade english-words to get version 2.0.0+.
error TypeError: 'frozenset' object does not support indexing
cause Trying to access an element by index on the frozenset returned by `get_words_set()`.
fix
Convert to list first: list(get_words_set())[0].
breaking In version 2.0.0, the old `english_words` module (importing a set directly) was replaced with a function-based API. Direct import of `english_words.english_words` or similar patterns no longer works.
fix Change imports to use `from english_words import get_words_set` and call the function.
deprecated Passing `word_set='en'` or other non-standard names may not work; only 'common', 'small', 'large' are officially supported.
fix Use one of the official word_set names: 'common', 'small', 'large'.
gotcha The returned object is a frozenset, not a list. Converting to list is required for index access or mutation.
fix Wrap with list() if you need sequential access: `list(get_words_set())`.

Quickly retrieve word sets.

from english_words import get_words_set

# Get the default (common English words) set
words = get_words_set()
print(len(words))  # e.g., 2000

# Get a specific word list
small = get_words_set(word_set='small')
print(list(small)[:5])

# Available sets: 'common' (default), 'small', 'large'