8.27 for Bi jobs

import jieba
import imageio
import wordcloud

1. Read the file contents

with open(r'D:\untitled2\回家的诱惑.txt.py','r',encoding='utf-8') as fr:
data=fr.read()

Use stammer module file content cut r

jieba.add_word ( 'Mickey Mouse') # so that "Mickey Mouse" has become a word
DATA_LIST = jieba.lcut (the Data)
the Data = '' .join (DATA_LIST)
Print (the Data)

3. want to find a picture of the structure shape

img = imageio.imread (r'D: \ untitled2 \ Mickey Mouse .jpg ')

4. The word cloud word cloud generating module

w=wordcloud.WordCloud(background_color='white',mask=img,font_path=r'C:\Windows\Fonts\msyh')
w.generate(data)
w.to_file('nihaosaoa.png')

Temptation to go home .txt
"Mickey Mouse and Donald Duck" is a rage comic cartoon.
Tablets with activity Mickey Mouse, Donald Duck, Pluto big dog as the main clue, through which a series of disjointed,
fragmented funny encounter, the use of anthropomorphic approach and psychology, biology, physics, philosophy, etc. various principles, to show the audience a humorous,
hilarious comedy paragraphs are highly artistic. Mickey Mouse was Walt Disney in 1928 to create animated characters, Disney representative.
Donald Duck is one of the creators of Disney's classic animated characters, which first appeared in 1934. [Synopsis] "Mickey Mouse and Donald Duck"
in Mickey Mouse stories always end in success, Donald Duck story always ends in failure, in fact, Mickey Mouse and Donald Duck are very smart. Mickey Mouse clever final always successful,
took away women Mickey Mouse lovely red lips. Donald opportunistic cleverness always worth the candle, began ambitious, and finally find any.

Guess you like

Origin www.cnblogs.com/lidandanaa/p/11420993.html