import jiebafrom wordcloud import WordCloud,STOPWORDSimport matplotlib.pyplot as pltfrom scipy.misc import imread back_ground = imread('F:/Python/PythonLeaning/测试专用文件夹/01300000165488121825589267854.png')s1 = 'Time is short life; But even if the targe
简单示例 from matplotlib import pyplot as plt from wordcloud import WordCloud filename = "text.txt" #文本路径 with open(filename,encoding="utf-8") as f: data = f.read() font = r'C:\Windows\Fonts\FZSTK.TTF' wc = WordCloud(font_path=font, # 如果是中
语料 text = """My fellow citizens: I stand here today humbled by the task before us, grateful for the trust you've bestowed, mindful of the sacrifices borne by our ancestors. I thank President Bush for his service to our nation -- (applause)
# -*- coding: utf-8 -*- #!/usr/bin/env python import re f = open("C:\\Users\\陶敏\\Documents\\Pyscript\\test.txt") str = f.read() li = re.split(r'[, ;.\n\t]',str) for i in li: if(len(i))==0: li.remove(i) res_world = [] res_count = [] for i in li:
# 使用Python进行词频统计 mytext = """Background Industrial Light & Magic (ILM) was started by filmmaker George Lucas, . ILM has won numerous Academy Awards for Best Visual Effects, not to mention a string of Clio awards for its work on televisi
from urllib import request import html.parser class zhuaqu(html.parser.HTMLParser): blogHtml = "" data = [] flag = 0 def getHtml(self): res = request.urlopen("http://www.cnblogs.com") self.blogHtml = res.read().decode('utf-8') def hand