From ff7b6e87022d8b45d0e2b8e212a8687855fef6cc Mon Sep 17 00:00:00 2001 From: ptkbf2lr5 <18759452262@163.com> Date: Wed, 18 Sep 2024 19:19:28 +0800 Subject: [PATCH] Delete 'cloudimage.py' --- cloudimage.py | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 cloudimage.py diff --git a/cloudimage.py b/cloudimage.py deleted file mode 100644 index b7d33e2..0000000 --- a/cloudimage.py +++ /dev/null @@ -1,20 +0,0 @@ -import jieba -import matplotlib.pyplot as plt -from wordcloud import WordCloud - -# 读取文本文件 -text = open(r"E:\softwareengineer\bulletscreentest\all_content.txt", encoding="utf-8").read() -# 对文本进行分词,默认精确模式 -text1=jieba.cut(text) -# 以空格作为分隔符,将分词后的所有字符串合并成一个新的字符串 -text = ' '.join(text1) -# 根据分词结果产生词云 -wc = WordCloud(font_path = "C:\Windows\Fonts\Microsoft YaHei UI\msyh.ttc",width=500, height=400, mode="RGBA", background_color=None).generate(text) -# 以图片的形式显示词云 -plt.imshow(wc, interpolation="bilinear") -# 不显示图像坐标系 -plt.axis("off") -# 显示图像 -plt.show() -#保存词云图 -wc.to_file(r"E:\softwareengineer\bulletscreentest\cloud.png")