当前位置: 首页 > news >正文

iis部署网站 asp 物理路径重庆建筑工程安全施工管理安全网

iis部署网站 asp 物理路径,重庆建筑工程安全施工管理安全网,网上商城英文,网站域名查询地址python几万条微博高频词分析看到别人有做影视热评的分析统计#xff0c;觉得挺好玩的#xff0c;就来试试看看效果Screenshot_2018-05-21-11-00-42-879_com.master.wei.png思路抓取想要的微博数据写入数据库分词统计出词汇出现次数过滤无意义的干扰词存入数据库写接口#x…python几万条微博高频词分析看到别人有做影视热评的分析统计觉得挺好玩的就来试试看看效果Screenshot_2018-05-21-11-00-42-879_com.master.wei.png思路抓取想要的微博数据写入数据库分词统计出词汇出现次数过滤无意义的干扰词存入数据库写接口然后Android端展示代码数据库连接 masterWeiBo.Utils.Sqlimport pymysqlimport pymysql.cursorsimport threadingclass Mydb(object):tableNamemasterdef __init__(self):self.lockthreading.Lock()self.client pymysql.connect(hostlocalhost,charsetutf8, port3306, userroot, passwdck123, dbweibo, cursorclasspymysql.cursors.DictCursor)self.client.autocommit(True)self.cursor self.client.cursor()开始import jiebafrom masterWeiBo.Utils.Sql import Mydb as db# 创建停用词listdef stopwordslist(filepath):stopwords [line.strip() for line in open(filepath, r, encodingutf-8).readlines()]return stopwordscursor db().cursor#如果不存在词表就创建cursor.execute(CREATE TABLE IF NOT EXISTS weibo.masterWeiBo_category (id INT NOT NULL AUTO_INCREMENT,count INT NOT NULL DEFAULT 0,category VARCHAR(100) NOT NULL,wordsTop10 VARCHAR(1000) NULL,PRIMARY KEY (id));)#清空词表cursor.execute(DELETE FROM weibo.masterWeiBo_category)#获取分类分词cursor.execute(SELECT count(id) as countd, come FROM weibo.masterWeiBo_master GROUP BY come)results cursor.fetchall()print(results)dicts[]#加载过滤词汇stopwords stopwordslist(/root/PYServer/myFirstPYServer/words.txt)for result in results:each{}each[count]result[countd]each[come]result[come]print(result[countd])print(result[come])cursor.execute(SELECT content from weibo.masterWeiBo_master where come result[come])contents cursor.fetchall()articals#把指定分类的内容拼接起来for artical in contents:articals,artical[content]#结巴分词cuts jieba.cut(articals)words{}#统计词频for cut in cuts:if(cut in words):words[cut]words[cut]1else:words[cut]1#按词频倒序排列sortedWords sorted(words.items(), keylambda d: d[1], reverseTrue)wordsTop10i0#获取top10词汇for key ,value in sortedWords:#过滤无效词汇if(key in stopwords or key.__len__()2):continuewordsTop10key,str(value);i1if(i10):wordsTop10wordsTop10[:wordsTop10.__len__()-1]breakeach[wordsTop10]wordsTop10dicts.append(each)#写入数据库for value in dicts:sql INSERT INTO weibo.masterWeiBo_category (count,category,wordsTop10) values( str(value[count]) , value[come] , value[wordsTop10] )print(sql)cursor.execute(sql)cursor.close()print(dicts)大功告成
http://www.yutouwan.com/news/306821/

相关文章:

  • 兰州优化网站推广南磨房网站建设公司
  • 学习php做毕设网站方向wordpress无法创建文件
  • 网站建设专业名词电商商城平台定制
  • 商务网站建设与维护 ppt一键生成微信小程序
  • 企业网站开发需求详细文档内容网站设计范例
  • 廊坊微信网站建设做网站聊城
  • 网站名称查询做可视化图表的网站
  • 传奇服务器网站如何建设莱芜找工作网站
  • 手机网站收录网站前端工资
  • 湖南免费网站建设证书查询入口官网
  • 网站建设所面临的问题网站搜不出来怎么办
  • 黄州区精神文明建设网站南平抖音搜索排名seo软件
  • 温州网站制作方案ui设计师是青春饭吗
  • 网站建设开公司现在好做吗北京高端设计公司有哪些
  • 宝安高端网站建设公司怎样做淘宝客网站
  • 怎么写代码做网站wordpress数据存储
  • seo网站快排制作网页和网站的区别
  • 临沂网站制作专业做视频课程的网站有哪些
  • 十大最佳摄影网站sem网站推广怎么做
  • 链接点开网页表白的网站怎么做的网站推广的方式和方法
  • 网站推广广告营销方案seo经验
  • 怎么在网站做视频接口增城做网站要多少钱
  • 庄河网站建设河北网站建设口碑好
  • 网站建设服务协议书网站开发工程师好不好
  • 网站后台模板html5黑镜主题2.0wordpress
  • 如何建设百度网站python快速搭建网站
  • 网站整体配色方案调用wordpress数据
  • 做h5找图网站怎么创建网页快捷方式到桌面
  • 易语言怎么做点击按钮打开网站wordpress下安装论坛 伪静态
  • 广东手机网站建设多少钱网站备案照