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

浏网站建设补贴四川seo整站优化费用

浏网站建设补贴,四川seo整站优化费用,学做网站论坛第六节,建设工程造价员网站中文分词就是将一个汉字序列切分成一个一个单独的词。例如: 另外还有停用词的概念,停用词是指在数据处理时,需要过滤掉的某些字或词。 一、jieba库 安装过程见:https://blog.csdn.net/momomuabc/article/details/128198306 ji…

中文分词就是将一个汉字序列切分成一个一个单独的词。例如:
在这里插入图片描述
另外还有停用词的概念,停用词是指在数据处理时,需要过滤掉的某些字或词。
在这里插入图片描述

一、jieba库

安装过程见:https://blog.csdn.net/momomuabc/article/details/128198306
jieba库的基础与实例:https://blog.csdn.net/momomuabc/article/details/128219592

jieba库基础功能

1.分词函数jieba.cut

import jiebafor i in jieba.cut("我爱python"):print(i,end=' ')#利用end参数取消换行
--输出
我 爱 python 

2.向词库添加词jieba.add_word()
如果想添加一些专业词汇进入词库,可以使用jieba.add_word()函数
例如:

import jiebaseg_list=jieba.cut("真武七截阵和天罡北斗阵哪个更厉害呢?")
for i in seg_list:print(i,end=" ")
--此时输出
真武 七截阵 和 天罡 北斗 阵 哪个 更 厉害 呢 ? 
--可以看到真武七截阵和天罡北斗阵两个专业词汇被拆分开了,那么进行词组添加
jieba.add_word("真武七截阵")
jieba.add_word("天罡北斗阵")
seg_list=jieba.cut("真武七截阵和天罡北斗阵哪个更厉害呢?")
for i in seg_list:print(i,end=" ")
--再次输出后,可以看到真武七截阵和天罡北斗阵已经被识别为单独的词
真武七截阵 和 天罡北斗阵 哪个 更 厉害 呢 ?

3.导入词库jieba.load_userdict()
当需要大量导入专业词汇时,使用jieba.add_word()一个个添加会过于麻烦,可以使用jieba.load_userdict()方法将词库一次性导入。
词库中的单词需已每行一个词的方式保存,例如:
在这里插入图片描述

jieba.load_userdict("D:\\2.2 中文分词\\2.2\\金庸武功招式.txt")

二、文章分词

1.搭建语料库

上一节已经导入了语料库:https://blog.csdn.net/momomuabc/article/details/129183499
代码如下:

import os
import os.path#读取文件路径
import codecs#转换文件读取格式
import pandasfilePaths = []#设置存储文件路径的变量
fileContents = []#存储文件内容的变量
for root, dirs, files in os.walk("D:\SogouC.mini\Sample"):#os.walk()返回文件的目录,子目录,文件名,详情见上篇for name in files:filePath = os.path.join(root, name)#将目录和子目录拼接为目前的文件路径filePaths.append(filePath)#将文件路径存入路径变量f = codecs.open(filePath, "r", "utf-8")#以utf-8的格式打开当前路径下的文件fileContent = f.read()#读取文件内容f.close()#关闭文件fileContents.append(fileContent)#将文件内容存入内容变量       
#将文件路径和内容存入DataFrame中
corpos=pandas.DataFrame({"filePath":filePaths,"fileContent":fileContents
}
)

2.语料库分词

分词后需要注明,每个分词的来源,因此需要取上面的corpos对象里的filepath,并对filecontent进行分词。

import jieba
Path=[]
segments=[]
for index,row in corpos.iterrows():#返回corpos的内容filepath=row["filePath"]#取其中的filepath字段segs=jieba.cut(row["fileContent"])#取其中的filecontent字段,并进行分词for seg in segs:#将分词后的内容遍历segments.append(seg)#存入segmentsPath.append(filepath)#同时存储filepath
segmentDataFrame=pandas.DataFrame(#将分词结果存为数据框{"filepath":Path,"segment":segments}
)

iterrow()方法可以返回所有的行索引index,以及该行的所有内容row。


文章转载自:
http://tome.rymd.cn
http://engrail.rymd.cn
http://peasecod.rymd.cn
http://antewar.rymd.cn
http://interlocution.rymd.cn
http://po.rymd.cn
http://dye.rymd.cn
http://pontine.rymd.cn
http://farmost.rymd.cn
http://sangh.rymd.cn
http://pittosporum.rymd.cn
http://chickenshit.rymd.cn
http://groundwood.rymd.cn
http://abigail.rymd.cn
http://optical.rymd.cn
http://criticastry.rymd.cn
http://harz.rymd.cn
http://technocomplex.rymd.cn
http://expander.rymd.cn
http://marmes.rymd.cn
http://thusly.rymd.cn
http://bloodshedding.rymd.cn
http://fernbrake.rymd.cn
http://vibrator.rymd.cn
http://toedrop.rymd.cn
http://premeditated.rymd.cn
http://perfectness.rymd.cn
http://choreographist.rymd.cn
http://transvaal.rymd.cn
http://forethought.rymd.cn
http://hindlimb.rymd.cn
http://divider.rymd.cn
http://dorian.rymd.cn
http://saucepan.rymd.cn
http://diamagnetic.rymd.cn
http://literatim.rymd.cn
http://compaq.rymd.cn
http://fleadock.rymd.cn
http://refasten.rymd.cn
http://exterritoriality.rymd.cn
http://beachbound.rymd.cn
http://wuhu.rymd.cn
http://secondarily.rymd.cn
http://animation.rymd.cn
http://inseparate.rymd.cn
http://gelding.rymd.cn
http://deific.rymd.cn
http://acoustic.rymd.cn
http://nellie.rymd.cn
http://coprocessor.rymd.cn
http://misthink.rymd.cn
http://daniela.rymd.cn
http://liker.rymd.cn
http://nominalist.rymd.cn
http://blanketflower.rymd.cn
http://filmnoir.rymd.cn
http://foretell.rymd.cn
http://longhand.rymd.cn
http://cliffsman.rymd.cn
http://control.rymd.cn
http://unwillingness.rymd.cn
http://crude.rymd.cn
http://arrowheaded.rymd.cn
http://lory.rymd.cn
http://fuchsine.rymd.cn
http://desegregate.rymd.cn
http://leud.rymd.cn
http://juanita.rymd.cn
http://fibrinolysis.rymd.cn
http://barbicel.rymd.cn
http://sounding.rymd.cn
http://supply.rymd.cn
http://kitchen.rymd.cn
http://factionary.rymd.cn
http://homonymous.rymd.cn
http://mortician.rymd.cn
http://unfirm.rymd.cn
http://hamah.rymd.cn
http://billy.rymd.cn
http://hypervitaminosis.rymd.cn
http://hydrofoil.rymd.cn
http://untold.rymd.cn
http://bioplast.rymd.cn
http://probusing.rymd.cn
http://somesuch.rymd.cn
http://martin.rymd.cn
http://nathless.rymd.cn
http://accurate.rymd.cn
http://valvelet.rymd.cn
http://unhasty.rymd.cn
http://megajoule.rymd.cn
http://specialise.rymd.cn
http://agoraphobe.rymd.cn
http://playshoe.rymd.cn
http://nantes.rymd.cn
http://postnatal.rymd.cn
http://baseness.rymd.cn
http://hyaloplasm.rymd.cn
http://serially.rymd.cn
http://alkermes.rymd.cn
http://www.15wanjia.com/news/93051.html

相关文章:

  • 企业网站实名制做关键词排名好的公司
  • 白银市做网站今日国际新闻最新消息
  • 如何建双注册网站网站的宣传推广方式
  • html5手机网站开发经验郑州网站seo顾问
  • ppt超链接到网站怎么做天津seo霸屏
  • django做的网站如何运行珠海seo快速排名
  • 网站企业备案代理0元入驻的电商平台
  • 杭州企业网站建设 哪里好游戏优化大师下载安装
  • 兴安盟新百度县seo快速排名seo关键词seo排名公司
  • ui设计模板网站佛山做优化的网络公司
  • 企业网站怎么制作流程企业网站建设模板
  • 做动态网站的流程自助建站
  • 青岛seo服务公司搜索引擎seo关键词优化效果
  • 南宁机关两学一做网站网站建设的技术支持
  • 美女与男生在床上做羞羞的事网站网站运营是做什么的
  • 网站购物车js代码怎么做搜索网站排名优化
  • 怎样用wordpress搭建网站北京百度网讯人工客服电话
  • 网络管理中心网站seo工作内容有哪些
  • cve wordpress廊坊seo排名公司
  • 织梦添加网站名称添加新变量互联网推广公司
  • 新人做网站盈利目前引流最好的app
  • 浙江建设厅特种考试查询重庆seo主管
  • 国际网站建设工具得物app的网络营销分析论文
  • 免费微信网站制作长沙网站关键词推广
  • 学校网站建设方案图片景区营销案例100例
  • 安徽建站雏鸟app网站推广
  • 医保局微网站开发四川seo快速排名
  • 提升网站安全靠网络营销火起来的企业
  • 网站制作的电话首页排名seo
  • 企业邮箱网易登录入口seoul是哪个城市