A predictable, interpretable wordcloud library
wrdcld
is available to install via pip
pip install wrdcld
To make a basic wordcloud, you simply pass a list of words to the make_word_cloud
function. Here is a basic example generating a word cloud of the Sherlock Holmes story The adventure of the dancing men.
from pathlib import Path
from wrdcld import make_word_cloud
contents = Path("examples/dancingmen.txt").read_text(encoding="utf-8")
all_words = [word.strip(" \n,.!?:-&\"'[]") for word in contents.split(" ")]
all_words = [word for word in all_words if word]
make_word_cloud(
all_words=all_words,
font_color=(0, 0, 0), # RGB
background_color=(255, 255, 255),
minimum_font_size=5,
).show()
Run poetry install
Run poetry run isort wrdcld tests
, poetry run black wrdcld tests
and poetry run pylint wrdcld tests
for styling and linting.
Run python -m unittest discover tests/