Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make word cloud by jieba

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to make word cloud in jieba". In daily operation, I believe many people have doubts about how to make word cloud in jieba. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to make word cloud in jieba". Next, please follow the editor to study!

Wordcloud is a very excellent word cloud display tool, and jieba is a third-party library for dealing with Chinese word segmentation. Install the two libraries pip install wordcloud and pip intsall jieba respectively.

The code for making ci Yun is as follows:

# Import jiba,wordcloudimport jieba import wordcloud # create thesaurus from Baidu encyclopedia's introduction to data science words = "data science was proposed in the 1960s, but it was not noticed and recognized by academia at that time, Peter in 1974. Noel's Concise Survey of computer methods defines data science as "the science of dealing with data, once the relationship between data and what it represents is established, it will provide reference for other fields and science." "data Science, Classification and related methods", held in Japan in 1996, has taken data science as the keyword of the conference. William S., American professor of statistics in 2001. Cleveland published "data Science: an Action Plan to expand the Technical Field of Statistics", so some people think that it is the first time for Cleveland to regard data science as a separate discipline. and the definition of data science as the field of statistics is extended to the combination of data as cash calculation objects, laying the theoretical foundation of data science. " # create a word cloud object, which can set the shape, size and color of the word cloud. Cloud = wordcloud.WordCloud (width=555,height=555,font_path='msyh.ttc') # load text cloud.generate ('/ '.join (jieba.lcut (words) # output the word cloud as a photo and save cloud.to_file (' datascience.png')

Note: the font_path parameter is in Microsoft yakuza font. For MAC OS and Linux systems, you need to replace it with the Chinese font installed by linux.

The effect is as follows:

Add:

Change the color of the background in the word cloud

Wordcloud.WordCloud (XMagnexGravity backgroundcolorproof colors white`)

Set the maximum text size and the minimum text size of the word cloud

Setting minimum: min_font_size () setting maximum: max_font_size () so far, the study on "how to make a word cloud in jieba" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report