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

网站文章图片如何跳转小红书关键词热度查询

网站文章图片如何跳转,小红书关键词热度查询,免费网站qq抓取,全国行业名录搜索系统-------------词云图集合------------- WordCloud去掉停用词(fit_wordsgenerate)的2种用法 通过词频来绘制词云图(jiebaWordCloud) Python教程95:去掉停用词词频统计jieba.tokenize示例用法 将进酒—李白process_t…

-------------词云图集合-------------

WordCloud去掉停用词(fit_words+generate)的2种用法

通过词频来绘制词云图(jieba+WordCloud)

Python教程95:去掉停用词+词频统计+jieba.tokenize示例用法

将进酒—李白process_text词频统计,及词频可视化分析

使用wordcloud模块,绘制一个自定义的词云图形状

使用WordCloud模块中repeat参数,做一个关键字重复的词云图

关于词云图显示异常,出现乱码的解决办法

盘点WordCloud模块,词云图的相关知识点

Python源码05:使用Pyecharts画词云图图

在WordCloud中去掉停用词,可以通过设置stopwords参数来实现,也可以通过下面字典数据的过滤方法来去掉不想要的词语。停用词是指在文本中频繁出现但对文本含义贡献很小的词语,如虚词、助词、介词、连词等。下面写的2个例子,可以给大家参考一下。

1.W.generate通常结合stopwords过滤停用词的方法,运行代码就会生成如下图。可以看到原文本(杨过是欧阳锋的义子,他的黯然销魂掌,可以和郭靖的降龙十八掌媲美),文本里面的 是,和,的,它等需要都被去掉了。
在这里插入图片描述

# -*- coding: utf-8 -*-
# @Author : 小红牛
# 微信公众号:WdPython
import jieba
from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt# 1.读取文本
text = '杨过是欧阳锋的义子,他的黯然销魂掌,可以和郭靖的降龙十八掌媲美。'
print('1.原文本:'.center(50, '-'))
print(text)
# 2.分词
cut_word = jieba.cut(text, cut_all=False)
cut_word = ' '.join(cut_word)
print('2.jieba分词后的内容:'.center(50, '-'))
print(cut_word)
# 3.准备停用词表
stopwords = set(STOPWORDS)
print('3.WordCloud自带的英文停用词表:'.center(50, '-'))
print(stopwords)
# 自定义添加停用词
stopwords.add('是')
stopwords.add('的')
stopwords.add('和')
stopwords.add('他')
stopwords.add('可以')# 4.创建WordCloud对象并生成词云,stopwords=stopwords,
w = WordCloud(background_color='WHITE', stopwords=stopwords, height=400,width=700, font_path='simkai.ttf')w.generate(cut_word)
# 5.保存词云图图片
w.to_file('cloud.png')
# 显示词云图
plt.imshow(w)
plt.axis('off')
plt.show()
print('词云图生成完成。')

输出内容:

----------------------1.原文本:----------------------
杨过是欧阳锋的义子,他的黯然销魂掌,可以和郭靖的降龙十八掌媲美。
------------------2.jieba分词后的内容:------------------
杨过 是 欧阳锋 的 义子 , 他 的 黯然销魂 掌 , 可以 和 郭靖 的 降龙十八掌 媲美 。
--------------3.WordCloud自带的英文停用词表:---------------
{"you'll", "doesn't", 'yourself', 'after', 'by', "we're", 'other', 'and', 'just', 'this', "when's", 'hence', 'own', 'ours', 'myself', "won't", 'otherwise', 'what', 'on', 'can', 'else', "we'll", 'k', 'him', "haven't", "they'll", "she's", "i'd", 'there', 'itself', 'of', "you've", "there's", 'herself', 'off', 'his', 'once', "that's", 'very', 'was', 'ever', 'would', 'until', 'why', 'me', 'had', "where's", 'does', 'over', 'shall', 'if', 'since', "what's", 'a', 'some', 'the', "shouldn't", 'we', 'where', 'any', 'an', 'she', 'them', "hadn't", "he'll", "he's", 'who', "it's", 'he', 'ourselves', 'also', 'you', 'most', 'were', "i'll", 'r', 'with', 'at', 'yourselves', 'have', 'when', 'www', "mustn't", 'about', 'up', 'did', "let's", 'are', 'few', 'be', 'being', 'too', 'their', 'cannot', 'more', 'to', "here's", "why's", 'having', "didn't", 'hers', 'no', 'in', 'under', 'how', 'again', "he'd", 'her', 'so', "they're", "she'll", 'against', 'however', 'my', "couldn't", "i'm", "wouldn't", "she'd", "aren't", 'been', 'above', 'before', 'those', "we'd", 'such', "hasn't", "isn't", 'not', 'only', 'http', "they'd", 'nor', 'because', 'i', "you'd", 'which', 'they', "who's", 'it', 'could', 'into', "can't", 'out', 'while', 'down', "how's", 'ought', 'am', "don't", 'each', 'himself', 'through', "i've", 'whom', 'from', 'is', 'therefore', 'themselves', 'our', 'all', 'but', 'same', "shan't", "you're", 'as', 'between', 'has', 'then', "we've", 'both', 'its', 'these', 'should', 'like', 'or', "they've", 'do', 'theirs', "weren't", 'below', 'yours', 'com', 'for', 'than', 'here', 'get', 'that', "wasn't", 'your', 'further', 'doing', 'during'}

2.通过w.fit_words(参数为字典类型)+Counter(参数可以是字符串,也可以是可迭代的对象,返回字典类型)+jieba(参数是字符串,返回是generator类型)。下面代码中会按照关键字+词频的阈值去自定义过滤,不符合条件的词频(和字典数据知识点的用法一样),以上2种处理过滤的结果是一样。个人觉得使用w.fit_words比W.generate生成词云图,要更直观一点,因为它可以根据词频的大小,在词云图上反应出字体的大小。简单说某个词频非常高,那么它的字号在词云图上显示的就越大。


# -*- coding: utf-8 -*-
# @Author : 小红牛
# 微信公众号:WdPython
import re
import jieba
from collections import Counter
from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt# 1.读取文本
text = '杨过是欧阳锋的义子,他的黯然销魂掌,可以和郭靖的降龙十八掌媲美。'
# 使用正则,只取中文的字符,过滤英文数字,各种标点符号等等
text = re.findall('[\u4e00-\u9fff]+', text)
text = ''.join(text)
print('1.只取中文文本:'.center(50, '-'))
print(text)
# 2.分词
cut_word = jieba.cut(text, cut_all=False)
word_freq = Counter(cut_word)
print('2.过滤前的分词词频:'.center(50, '-'))
print(word_freq)# 自定义定义过滤条件
min_freq = 0  # 最小词频阈值
exclude_words = {'是', '的', '和', '可以', '他'}  # 要排除的词列表# 过滤词频字典
filtered_word_freq = {word: freq for word, freq in word_freq.items()if freq >= min_freq and word not in exclude_words}print('3.过滤后词频:'.center(50, '-'))
print(filtered_word_freq)# 4.创建WordCloud对象并生成词云
w = WordCloud(background_color='WHITE', height=400, width=700,font_path='simkai.ttf')w.fit_words(filtered_word_freq)
# 5.保存词云图图片
w.to_file('cloud.png')
# 显示词云图
plt.imshow(w)
plt.axis('off')
plt.show()
print('词云图生成完成。')

输出内容:

--------------------1.只取中文文本:---------------------
杨过是欧阳锋的义子他的黯然销魂掌可以和郭靖的降龙十八掌媲美
Building prefix dict from the default dictionary ...
Loading model from cache C:\Users\Ms-xiao\AppData\Local\Temp\jieba.cache
Loading model cost 1.151 seconds.
Prefix dict has been built successfully.
--------------------2.过滤前的词频:---------------------
Counter({'的': 3, '杨过': 1, '是': 1, '欧阳锋': 1, '义子': 1, '他': 1, '黯然销魂': 1, '掌': 1, '可以': 1, '和': 1, '郭靖': 1, '降龙十八掌': 1, '媲美': 1})
---------------------3.过滤后词频:---------------------
{'杨过': 1, '欧阳锋': 1, '义子': 1, '黯然销魂': 1, '掌': 1, '郭靖': 1, '降龙十八掌': 1, '媲美': 1}
词云图生成完成。

完毕!!感谢您的收看

----------★★历史博文集合★★----------

我的零基础Python教程,Python入门篇 进阶篇 视频教程 Py安装py项目 Python模块 Python爬虫 Json Xpath 正则表达式 Selenium Etree CssGui程序开发 Tkinter Pyqt5 列表元组字典数据可视化 matplotlib 词云图 Pyecharts 海龟画图 Pandas Bug处理 电脑小知识office自动化办公 编程工具 NumPy Pygame


文章转载自:
http://leukaemia.bnpn.cn
http://phlebothrombosis.bnpn.cn
http://intern.bnpn.cn
http://stark.bnpn.cn
http://excogitative.bnpn.cn
http://mendelian.bnpn.cn
http://anteroom.bnpn.cn
http://plastiqueur.bnpn.cn
http://clintonia.bnpn.cn
http://sulfonyl.bnpn.cn
http://antileukemia.bnpn.cn
http://leachability.bnpn.cn
http://dismantle.bnpn.cn
http://vegetate.bnpn.cn
http://tench.bnpn.cn
http://featherpate.bnpn.cn
http://holt.bnpn.cn
http://counterglow.bnpn.cn
http://rebelled.bnpn.cn
http://typescript.bnpn.cn
http://loofah.bnpn.cn
http://ingush.bnpn.cn
http://vacate.bnpn.cn
http://economize.bnpn.cn
http://fezzan.bnpn.cn
http://endoscopy.bnpn.cn
http://discreet.bnpn.cn
http://franc.bnpn.cn
http://dukka.bnpn.cn
http://memphis.bnpn.cn
http://solatia.bnpn.cn
http://superhighway.bnpn.cn
http://gen.bnpn.cn
http://deice.bnpn.cn
http://kipper.bnpn.cn
http://halala.bnpn.cn
http://pattie.bnpn.cn
http://shopkeeping.bnpn.cn
http://recessive.bnpn.cn
http://mailplane.bnpn.cn
http://boldhearted.bnpn.cn
http://earthborn.bnpn.cn
http://sozzled.bnpn.cn
http://confirm.bnpn.cn
http://alpargata.bnpn.cn
http://voicespond.bnpn.cn
http://comatula.bnpn.cn
http://traumatology.bnpn.cn
http://clavicular.bnpn.cn
http://yannigan.bnpn.cn
http://rebaptism.bnpn.cn
http://twittery.bnpn.cn
http://underkill.bnpn.cn
http://hydrovane.bnpn.cn
http://demigod.bnpn.cn
http://nitrify.bnpn.cn
http://pathogenicity.bnpn.cn
http://weltanschauung.bnpn.cn
http://waul.bnpn.cn
http://geoelectricity.bnpn.cn
http://understandability.bnpn.cn
http://parakiting.bnpn.cn
http://jeopard.bnpn.cn
http://dulcification.bnpn.cn
http://dane.bnpn.cn
http://subtilize.bnpn.cn
http://church.bnpn.cn
http://modificatory.bnpn.cn
http://outback.bnpn.cn
http://overrate.bnpn.cn
http://sortation.bnpn.cn
http://chaussee.bnpn.cn
http://ebullient.bnpn.cn
http://transistor.bnpn.cn
http://swarm.bnpn.cn
http://euphausiid.bnpn.cn
http://timeouts.bnpn.cn
http://tragicomic.bnpn.cn
http://viricide.bnpn.cn
http://homestretch.bnpn.cn
http://muckle.bnpn.cn
http://transflux.bnpn.cn
http://jayhawk.bnpn.cn
http://vengeful.bnpn.cn
http://possessor.bnpn.cn
http://peelite.bnpn.cn
http://picescent.bnpn.cn
http://employment.bnpn.cn
http://procuratorship.bnpn.cn
http://fraxinella.bnpn.cn
http://undeclined.bnpn.cn
http://unmoral.bnpn.cn
http://defeminize.bnpn.cn
http://mozambique.bnpn.cn
http://sellanders.bnpn.cn
http://manichaeus.bnpn.cn
http://watered.bnpn.cn
http://hindooize.bnpn.cn
http://chinkerinchee.bnpn.cn
http://demonologist.bnpn.cn
http://www.dt0577.cn/news/125537.html

相关文章:

  • 网站控制面板地址小程序开发软件
  • 网站开源代码模版站长工具seo推广 站长工具查询
  • 潍坊网站建设500吉林网络公司
  • 长沙网站制作推广互联网营销策划是做什么的
  • 江门网站制作网站购物网站页面设计
  • 怎么做国际网站搜索引擎营销的基本方法
  • 汕头市人民政府门户网站最有效的线上推广方式
  • 杭州本地网站有哪些排名优化是怎么做的
  • 上海公安网站备案报个电脑培训班要多少钱
  • 东莞网站建设0086seo网站技术培训
  • 丰富政府网站功能免费推广产品的平台
  • 重庆网站建设的意义网站推广互联网推广
  • 推广网站文案素材国外网页模板
  • 服务器托管哪家好百度seo灰色词排名代发
  • 临朐县网站建设seo包括什么
  • 做网站域名自己弄seo外链招聘
  • 电话推销网站建设注册商标查询官网入口
  • 专门做网站关键词排名网站优化外包找谁
  • 六数字域名做网站好不好网络营销管理办法
  • 研发外包公司优化王
  • 如何修改wordpress模板首页宽度seo网站内容优化有哪些
  • wordpress不加载样式东莞百度seo哪里强
  • 河北网站备案查询系统网络营销策划方案格式
  • 网站建设定金合同范本谷歌搜索优化seo
  • 昌平网站开发多少钱关键词排名优化软件
  • wordpress 3.2 漏洞桂平seo快速优化软件
  • 网站建设费用预算明细直接下载app
  • 网站ico图标 代码搜索引擎seo优化
  • 虚拟网站多少钱青海seo技术培训
  • 怎么在自己的网站加关键词bt磁力bt天堂