Python - "word cloud" analysis

When I was browsing csdn today, I saw someone else made a very dazzling "word cloud". It felt very simple, so I wanted to make one in Python on a whim, but there were a lot of difficulties in the cutscene, embarrassing , okay, nonsense Not much to say, just get started.
1. What is a "Wordcloud"?
        Word cloud" is to visually highlight the "keywords" that appear frequently in the text to form a "keyword cloud layer" or "keyword rendering", so as to filter out a large amount of text information, so that web browsers only need to scan at a glance. The main idea of ​​the text can be understood by reading the text.
        We often see pictures like the one below on the Internet.
        
        


These are the so-called "word cloud" diagrams, so how are these cool patterns made? Considering the difficulty, they are very basic today, and I believe most people can understand them.
2. Before doing this, use the following tools and third-party libraries.
        Python version: 3.5.4 (2.7 version also works)
        Related modules:
        1.Wordcloud
        2.Anaconda
        3.Jupter Notebook
3. Installation process (because my computer is Windows, so I use win10 throughout)
Install Anaconda:

According to the properties of your computer, choose the appropriate version:
After the download is complete, select next/I agree/finish and the like to complete the installation!
After installation, open the main interface and you will see something like this:

Select the first one, open the terminal: enter Jupyter Notebook
It will automatically jump to another website:

At this point , the installation of Jupyter Notebook has been completed .
Next continue to install Wordcloud
        We know that when a third-party library needs to be introduced on Python, it is usually necessary to enter on cmd:
pip install xxx (libraries)
就可以了,但是安装 Wordcloud在Windows上行不通,在Mac上可以。
刚开始,我用pip就出现了一下情况:
错误提示:
于是在Github:找到 wordcloud‑1.3.1‑cp27‑cp27m‑win64.whl下载解压。
完成之后:
键入以下命令:

mkdir democd demo

于是有一个目录叫demo了。在“我的电脑”,找到这个目录并且打开它。
将 wordcloud‑1.3.1‑cp27‑cp27m‑win64.whl 这个文件。下载后将它拖拽到你的demo目录里。
在命令行下,先执行:
pip install wheel
然后,再执行:
pip install wordcloud‑1.3.1‑cp27‑cp27m‑win64.wh
好了,我们需要的全部Python运行环境终于装好了。
然后在 jupter Notebook中直接上代码:
这样,就可以完整的做出“词云”图了。
为了照顾到大家,请到这个网站: https://wordart.com/create 就可以做成各种各样的图案。
直接上图:


好了,今天的故事就到这里,赶紧去玩玩吧!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325787472&siteId=291194637