- Saved searches
- Use saved searches to filter your results more quickly
- License
- TomasKeller/python-WordCloud
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- word_cloud
- Installation
- Installation notes
- Examples
- Command-line usage
- Licensing
- Пакет Wordcloud в Python – создаем облако слов
- Установка Pandas
- Установка Matplotlib
- Проверка установки
- Установка Wordcloud
- Saved searches
- Use saved searches to filter your results more quickly
- License
- amueller/word_cloud
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Copy from amueller/word_cloud.git
License
TomasKeller/python-WordCloud
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
A little word cloud generator in Python. Read more about it on the blog post or the website. The code is Python 2, but Python 3 compatible.
If you are using conda, it might be even easier to use anaconda cloud:
conda install -c https://conda.anaconda.org/amueller wordcloud
For a manual install get this package:
wget https://github.com/amueller/word_cloud/archive/master.zip unzip master.zip rm master.zip cd word_cloud-master
worcloud depends on numpy>=1.5.1, pillow and matplotlib. To install it via pip, you will also need a C compiler.
If you’re having trouble with pip installation on windows, you can find a .whl file at:
If the installation of the package fails, due to a missing pyconfig.h file, you need to install the python-dev package.
sudo apt-get install python-dev
sudo apt-get install python3-dev
If the compilation via gcc of the package fails, due to a missing Python.h file, you need to install the python-devel package.
sudo yum install -y python-devel
sudo yum install -y python34-devel
Check out examples/simple.py for a short intro. A sample output is:
Or run examples/masked.py to see more options. A sample output is:
Getting fancy with some colors:
The wordcloud_cli.py tool can be used to generate word clouds directly from the command-line:
$ wordcloud_cli.py --text mytext.txt --imagefile wordcloud.png
If you’re dealing with PDF files, then pdftotext , included by default with many Linux distribution, comes in handy:
$ pdftotext mydocument.pdf - | wordcloud_cli.py --imagefile wordcloud.png
In the previous example, the — argument orders pdftotext to write the resulting text to stdout, which is then piped to the stdin of wordcloud_cli.py .
Use wordcloud_cli.py —help so see all available options.
Reddit Cloud is a Reddit bot which generates word clouds for comments in submissions and user histories. You can see it being operated on /u/WordCloudBot2 (top posting).
Chat Stats is a visualization program for Twitch streams, which generates word clouds for comments made by Twitch users in the chat. It also creates various charts and graphs pertaining to concurrent viewership and chat rate over time.
Twitter Word Cloud Bot is a twitter bot which generates word clouds for twitter users when it is mentioned with a particular hashtag. Here you can see it in action, while here you can see all the word clouds generated so far.
Stack Overflow Users Tag Cloud
Stackoverflow Tag Cloud generates tag clouds of users on Stack Overflow or any Stack Exchange site. If you are contributing to Stack Overflow community, it’s an easy way to share your expertise with others through an image. Here’s Stack Overflow’s highest reputation user Jon Skeet’s tag cloud —
Send a pull request to add yours here.
Using Pillow instead of PIL might might get you the TypeError: ‘int’ object is not iterable problem also showcased on the blog.
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 the font_path variable when creating a WordCloud object.
About
Copy from amueller/word_cloud.git
word_cloud
A little word cloud generator in Python. Read more about it on the blog post or the website.
The code is tested against Python 3.7, 3.8, 3.9, 3.10, 3.11.
Installation
If you are using conda, you can install from the conda-forge channel:
conda install -c conda-forge wordcloud
Installation notes
wordcloud depends on numpy , pillow , and matplotlib .
If there are no wheels available for your version of python, installing the package requires having a C compiler set up. Before installing a compiler, report an issue describing the version of python and operating system being used.
Examples
Check out examples/simple.py for a short intro. A sample output is:
Or run examples/masked.py to see more options. A sample output is:
Getting fancy with some colors:
Generating wordclouds for Arabic:
Command-line usage
The wordcloud_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, then pdftotext , included by default with many Linux distribution, comes in handy:
$ pdftotext mydocument.pdf - | wordcloud_cli --imagefile wordcloud.png
In the previous example, the — argument orders pdftotext to write the resulting text to stdout, which is then piped to the stdin of wordcloud_cli.py .
Use wordcloud_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 the font_path variable when creating a WordCloud object.
Пакет Wordcloud в Python – создаем облако слов
Пакет Wordcloud в Python помогает нам узнать частоту появления слова в текстовом контенте с помощью визуализации.
Чтобы реализовать это, нам нужно сначала установить некоторые пакеты, такие как pandas, matplotlib и Wordcloud. Давайте посмотрим на этапы установки каждого.
Установка Pandas
Pandas – отличный инструмент для реализации анализа и визуализации данных в Jupyter Notebook. Его можно импортировать в наш исходный код следующим образом:
PD относится к процессу создания псевдонимов, с помощью которого могут быть созданы фреймы данных, и это упрощает читаемость кода.
Pandas можно установить двумя способами:
Давайте посмотрим, как мы можем установить pandas с помощью командной строки:
- Открыть командную строку.
- Ввести данную команду:pip install pandas
- После нажатия «Enter» пакеты начнут загружаться в систему.
Эту же команду можно использовать в Linux в терминале для установки pandas в нашей системе.
Второй способ установить pandas – использовать Anaconda Navigator.
- Откройте Anaconda Navigator.
- Щелкните вкладку «Среда» и перейдите к параметру создания, чтобы настроить Pandas в вашей системе.
- Нажмите на кнопку «Создать» для среды Pandas.
- В списке пакетов выберите «Все», чтобы получить фильтры.
- Перейдите в строку поиска, найдите «Pandas» и выберите «Pandas package».
- Щелкните правой кнопкой мыши флажок и выберите «Отметить для установки определенной версии».
- Выберите версию, которую хотите установить, и нажмите кнопку «Применить», чтобы установить пакеты.
Установка Matplotlib
Matplotlib – обширная и интересная библиотека для людей, которые с энтузиазмом относятся к выводам результатов из данных, включает в себя диаграммы рассеяния, гистограммы, коробчатые диаграммы и многое другое, что упрощает нам понимание.
Matplotlib можно установить, выполнив следующие действия:
Matplotlib можно установить в нашей системе с помощью данной команды в командной строке:
Мы можем установить matplotlib с помощью Anaconda, набрав следующую команду в Anaconda Prompt:
Проверка установки
Мы можем проверить, успешно ли установлен matplotlib в нашей системе или нет, набрав данную программу в терминале.
import matplotlib matplotlib.__version__
Установка Wordcloud
Как обсуждалось ранее, это дает нам представление о наиболее часто встречающихся словах в тексте с помощью визуального элемента.
WordCloud можно установить, выполнив следующие действия:
conda install -c conda-forge wordcloud
Теперь давайте посмотрим на простую программу, которая показывает, как wordcloud можно использовать в Python.
Мы взяли этот фрагмент текста с веб-сайта и сохранили как файл sunflowers1.txt.
"Sunflowers are heliotropic, which means that they turn their flowers to follow the movement of the Sun across the sky east to west, and then returns at night to face the east, ready again for the morning sun. Heliotropism happens during the earlier stages before the flower grows heavy with seeds. There are tons of varieties of sunflowers available today, so there's bound to be one that fits your garden. Choose between those with branching stems or single stems, those that produce ample pollen for pollinators or are pollen-free(best for bouquets), those that stay small or tower above the rest of the garden, or those that produce edible seeds! "
import re import matplotlib.pyplot as plt from wordcloud import WordCloud, STOPWORDS text = open("/content/sunflowers1.txt", "r").read() # Clean text text = re.sub(r'==.*?==+', '', text) text = text.replace('\n', '') # Define a function to plot word cloud def plot_cloud(wordcloud): # Set figure size plt.figure(figsize=(40, 30)) # Display image plt.imshow(wordcloud) # No axis details plt.axis("off") # Generate word cloud wordcloud = WordCloud(width = 3000, height = 2000, random_state=1, background_color='salmon', colormap='Pastel1', collocations=False, stopwords = STOPWORDS).generate(text) plot_cloud(wordcloud)
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
A little word cloud generator in Python
License
amueller/word_cloud
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
* bump buildwheel version * bump macos version
Git stats
Files
Failed to load latest commit information.
README.md
A little word cloud generator in Python. Read more about it on the blog post or the website.
The code is tested against Python 3.7, 3.8, 3.9, 3.10, 3.11.
If you are using conda, you can install from the conda-forge channel:
conda install -c conda-forge wordcloud
wordcloud depends on numpy , pillow , and matplotlib .
If there are no wheels available for your version of python, installing the package requires having a C compiler set up. Before installing a compiler, report an issue describing the version of python and operating system being used.
Check out examples/simple.py for a short intro. A sample output is:
Or run examples/masked.py to see more options. A sample output is:
Getting fancy with some colors:
Generating wordclouds for Arabic:
The wordcloud_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, then pdftotext , included by default with many Linux distribution, comes in handy:
$ pdftotext mydocument.pdf - | wordcloud_cli --imagefile wordcloud.png
In the previous example, the — argument orders pdftotext to write the resulting text to stdout, which is then piped to the stdin of wordcloud_cli.py .
Use wordcloud_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 the font_path variable when creating a WordCloud object.
About
A little word cloud generator in Python