代码拉取完成,页面将自动刷新
import mysql
from wordcloud import WordCloud
from PIL import Image
from matplotlib import pyplot as plt
class Cloud:
def __init__(self):
# 实例化数据库对象
print(">>>链接数据库")
self.__sql = mysql.MySql()
def __del__(self):
print(">>>词云生成成功")
'''首页'''
# 生成热门岗位词云图
def popularJobs(self):
text = self.__sql.getJobName()
Str = str(text).replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\热门岗位.jpg')
# 总体福利热词
def welfareCloud(self):
text = self.__sql.getWelfare()
Str = str(text).replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\福利待遇.jpg')
'''java'''
def javaSkillCloud(self):
text = self.__sql.javaGetSkill()
Str = str(text).replace('Java', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\Java技术热词.jpg')
'''python'''
def pythonSkillCloud(self):
text = self.__sql.pythonGetSkill()
Str = str(text).replace('Python', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\Python技术热词.jpg')
'''c/c++'''
def cSkillCloud(self):
text = self.__sql.cGetSkill()
Str = str(text).replace('Python', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\C C++技术热词.jpg')
'''c#/.net'''
def c23SkillCloud(self):
text = self.__sql.c23GetSkill()
Str = str(text).replace('Python', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\C23技术热词.jpg')
'''u3due'''
def u3dUeSkillCloud(self):
text = self.__sql.u3dUeGetSkill()
Str = str(text).replace('Python', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\u3dUe技术热词.jpg')
'''PHP'''
def phpSkillCloud(self):
text = self.__sql.phpGetSkill()
Str = str(text).replace('Python', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\php技术热词.jpg')
'''PHP'''
def webSkillCloud(self):
text = self.__sql.webGetSkill()
Str = str(text).replace('Python', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\web技术热词.jpg')
'''Android'''
def AndroidSkillCloud(self):
text = self.__sql.AndroidGetSkill()
Str = str(text).replace('Java', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\Android技术热词.jpg')
'''ios'''
def iosSkillCloud(self):
text = self.__sql.iosGetSkill()
Str = str(text).replace('Java', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\ios技术热词.jpg')
'''algorithm'''
def algorithmSkillCloud(self):
text = self.__sql.algorithmGetSkill()
Str = str(text).replace('Java', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\algorithm技术热词.jpg')
'''test'''
def testSkillCloud(self):
text = self.__sql.testGetSkill()
Str = str(text).replace('Java', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\test技术热词.jpg')
'''oam'''
def oamSkillCloud(self):
text = self.__sql.oamGetSkill()
Str = str(text).replace('Java', '').replace("'", '').replace(",", '')
wc = WordCloud(
scale=1,
background_color='white',
font_path=r'C:\Windows\Fonts\msyh.ttc',
min_font_size=1,
max_font_size=60,
width=750,
height=400
)
wc.generate_from_text(Str)
plt.axis('off')
wc.to_file(r'C:\Users\koishi\OneDrive\桌面\毕设\static\img\cloud\oam技术热词.jpg')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。