Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A little word cloud generator in Python

License

NotificationsYou must be signed in to change notification settings

amueller/word_cloud

Repository files navigation

licenceDOI

word_cloud

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.

Installation

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

Installation notes

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.

Examples

Check outexamples/simple.py for a short intro. A sample output is:

Constitution

Or runexamples/masked.py to see more options. A sample output is:

Alice in Wonderland

Getting fancy with some colors:Parrot with rainbow colors

Generating wordclouds for Arabic:

Arabic wordlcloud

Command-line usage

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.

Licensing

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.


[8]ページ先頭

©2009-2025 Movatter.jp