- Notifications
You must be signed in to change notification settings - Fork2.3k
A little word cloud generator in Python
License
amueller/word_cloud
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A little word cloud generator in Python. Read more about it on theblogpost or thewebsite.
The code is tested against Python 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13.
If you are using pip:
pip install wordcloud
If you are using conda, you can install from theconda-forge
channel:
conda install -c conda-forge wordcloud
wordcloud depends onnumpy
,pillow
, andmatplotlib
.
If there are no wheels available for your version of python, installing thepackage requires having a C compiler set up. Before installing a compiler, reportan issue describing the version of python and operating system being used.
Check outexamples/simple.py for a short intro. A sample output is:
Or runexamples/masked.py to see more options. A sample output is:
Getting fancy with some colors:
Generating wordclouds for Arabic:
Thewordcloud_cli
tool can be used to generate word clouds directly from the command-line:
$ wordcloud_cli --text mytext.txt --imagefile wordcloud.png
If you're dealing with PDF files, thenpdftotext
, included by default with many Linux distribution, comes in handy:
$ pdftotext mydocument.pdf - | wordcloud_cli --imagefile wordcloud.png
In the previous example, the-
argument orderspdftotext
to write the resulting text to stdout, which is then piped to the stdin ofwordcloud_cli.py
.
Usewordcloud_cli --help
so see all available options.
The wordcloud library is MIT licenced, but contains DroidSansMono.ttf, a true type font by Google, that is apache licensed.The font is by no means integral, and any other font can be used by setting thefont_path
variable when creating aWordCloud
object.
About
A little word cloud generator in Python