51job词云
爬取的51job上的python岗位任职要求,形成了词云:
# coding:utf-8 import jieba #分词 import matplotlib.pyplot as plt #数据可视化 import wordcloud from wordcloud import WordCloud,ImageColorGenerator,STOPWORDS #词云 import numpy as np #科学计算 from PIL import Image #处理图片 #打开文本 text = open("workinfo.txt","rb").read() #rb二进制读取, textfile=text.decode("utf-8") #按照utf-8解码 textfile=textfile.replace("span","").replace("style","").replace("font","").replace("nbsp","") textfile=textfile.replace("line","").replace("height","").replace("color","").replace("family","") textfile=textfile.replace("size","").replace("宋体","").replace("rgb","").replace("white","") textfile=textfile.replace("space","").replace("normal","").replace("backgroud","").replace("14px","") textfile=textfile.replace("br","").replace("岗位","").replace("职责","").replace("0px","") textfile=textfile.replace("Microsoft","").replace("YaHei","").replace("margin","").replace("top","") textfile=textfile.replace("以上","").replace("上学","").replace("div","").replace("li","").replace("以及","") textfile.replace("任职要求","") wordlist=jieba.cut_for_search(textfile) space_list=" ".join(wordlist)#链接词语 backgroud=np.array(Image.open("2.jpg")) #背景图片 mywordcloud=WordCloud(width=1800, height=1400,background_color="black", #背景颜色 mask=backgroud,#写字用的背景图,从背景图取颜色 max_words=200, #最大词语数量 stopwords=STOPWORDS, #停止的默认词语 font_path="simkai.ttf", #字体 max_font_size=200, #最大字体尺寸 random_state=50,#随机角度 scale=2).generate(space_list) #生成词云 plt.rcParams['figure.dpi'] = 1800 # 修改dpi 修改图片大小 plt.rcParams['savefig.dpi']=1400 # 修改dpi image_color=ImageColorGenerator(backgroud) #生成词云的颜色 plt.imshow(mywordcloud) #显示词云 plt.axis("off") #关闭保存 plt.savefig("python.png") plt.show()
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?