资源简介
中文分词工具的效果评测
代码片段和文件信息
# -*- coding: utf-8 -*-
“““
Created on Tue Oct 29 17:57:11 2019
@author: jyt
Email:904771477@qq.com
“““
import pandas as pd
import os
import datetime
import models.public_modles as models
import models.tool_api as tool_api
api = tool_api.tool_apis()
os.environ[“NLS_LANG“] = ‘.AL32UTF8‘
endresult=pd.Dataframe([]columns=[‘算法‘‘字的位置‘‘R‘‘P‘‘F1‘])
#line=[]
#file=open(r‘E:/python-work/中文分词数据集/好数据/2015/trainSeg.txt‘‘r‘encoding=‘utf-8‘)
#for i in file.readlines():
# line.append(i.split(‘\n‘))
#datajj=pd.Dataframe(linecolumns=[‘character‘‘train‘]).fillna(‘‘)
#data = datajj[‘character‘].str.split(‘\t‘1True).fillna(‘‘)
datajj = pd.read_excel(r‘E:/python-work/中文分词数据集/人工标注数据/可以用的数据/xxl.xlsx‘)
data = datajj.copy().fillna(‘‘)
data.columns = [‘character‘‘train‘]
each_text=pd.Dataframe([]columns=[‘text‘‘train‘])
str1=‘‘
train=[]
for x in range(0len(data)):
if data[‘character‘][x]!=‘‘:
str1=str1+str(data[‘character‘][x])
train.append([data[‘character‘][x]data[‘train‘][x]])
else:
train = pd.Dataframe(traincolumns=[‘character‘‘train‘])
dat1=pd.Dataframe([[str1train]]columns=[‘text‘‘train‘])
each_text=each_text.append(dat1)
str1=‘‘
train=[]
each_text=each_text.reset_index(drop=True)
#%%
res_jieba = pd.Dataframe([] columns=[‘character‘‘test‘])
for x in range(0len(each_text)):
sentence = each_text[‘text‘][x]
result= api.jieba_api(sentence ‘cutword‘)
res_jieba = models.turn_resulttype(result each_text[‘train‘][x] sentence res_jieba)
res_jieba = res_jieba.append(pd.Dataframe([[‘‘‘‘]] columns=[‘character‘ ‘test‘]))
res_jieba = res_jieba.reset_index(drop=True)
data[‘test_jieba‘]=res_jieba[‘test‘].copy()
endresult = endresult.append(models.all_score(data ‘test_jieba‘ ‘jieba‘))
time1 = datetime.datetime.now()
for x in range(0len(each_text)):
sentence = each_text[‘text‘][x]
result= api.jieba_api(sentence ‘cutword‘)
time2 = datetime.datetime.now()
jieba_cost = time2 - time1
print(jieba_cost)
#%%nlpir
res_nlpir = pd.Dataframe([] columns=[‘character‘‘test‘])
for x in range(0len(each_text)):
sentence = each_text[‘text‘][x]
result= api.nlpir_api(sentence ‘cutword‘)
res_nlpir = models.turn_resulttype(result each_text[‘train‘][x] sentence res_nlpir)
res_nlpir = res_nlpir.append(pd.Dataframe([[‘‘‘‘]] columns=[‘character‘ ‘test‘]))
res_nlpir = res_nlpir.reset_index(drop=True)
data[‘test_nlpir‘]=res_nlpir[‘test‘].copy()
endresult = endresult.append(models.all_score(data ‘test_nlpir‘ ‘nlpir‘))
time1 = datetime.datetime.now()
for x in range(0len(each_text)):
sentence = each_text[‘text‘][x]
result= api.nlpir_api(sentence ‘cutword‘)
time2 = datetime.datetime.now()
nlpir_cost = time2 - time1
print(nlpir_cost)
#%%ltp
res_ltp = pd.Dataframe([] columns=[‘character‘‘test‘])
for x in range(0len(each_text)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6995 2019-10-31 20:39 中文分词工具评测\index.py
文件 10240 2019-10-13 09:59 中文分词工具评测\jieba_nlpir_ltp_在trainseg上的表现.spydata
文件 4514 2019-10-31 20:33 中文分词工具评测\models\public_modles.py
文件 5902 2019-10-29 21:27 中文分词工具评测\models\tool_api.py
文件 3394 2019-10-31 20:33 中文分词工具评测\models\__pycache__\public_modles.cpython-36.pyc
文件 3773 2019-10-29 21:29 中文分词工具评测\models\__pycache__\tool_api.cpython-36.pyc
文件 5217 2019-10-29 18:34 中文分词工具评测\Tools_of_cutword_Score.py
文件 3552350 2019-10-29 21:31 中文分词工具评测\人工标注结果.xlsx
目录 0 2019-10-31 20:33 中文分词工具评测\models\__pycache__
目录 0 2019-10-29 18:08 中文分词工具评测\models
目录 0 2020-07-18 10:15 中文分词工具评测
----------- --------- ---------- ----- ----
3592385 11
- 上一篇:Ply解析(二进制OrAscii)
- 下一篇:没有了
相关资源
- A Byte of Python(简明Python教程)(第
- IIs put上传工具
- cs破解工具
- labelImg-1.8.1(图片标注工具)
- Python 3.8.5中文指南
- Ansible 中文手册
- 缠论dll(czsc - 缠中说禅技术分析工具
- MicroPython中文教程
- Tushare库打造股票筛选工具
- 自动截屏工具(python源码)
- Python100经典练习题
- QPA进程抓包工具
- 中山大学-自然语言处理-中文分词项目
- Python其它开发工具的安装与使用.ppt
- OpenCV入门教程+OpenCV官方教程中文版
- Python 串口工具源码+.exe文件
- 蓝奏云批量上传工具.zip
- Python 3.5.2 中文文档 互联网唯一CHM版本
- python机器学习Sebastian Raschka中文最新完
- 用python绘制txt文本中中文汉字的词云
- Python-本项目基于yolo3与crnn实现中文自
- 图形识别与颜色识别工具
- Python网络编程 3版 高清扫描版 完整中
- 正方教务系统新版sql注入漏洞利用工
- Python for data analysis(第二版中文版代
- Python灰帽子-黑客与逆向工程师的Pyt
- deep learning with python 中文版
- 最大匹配法分词Python
- 《Python绝技》:运用Python成为顶级黑
- QGIS的GeoHey-Toolbox-0.2纠偏工具
评论
共有 条评论