import nltk from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer #预处理 def preprocessing(text): tokens=[word for sent in nltk.sent... ...
分类:
其他好文 时间:
2018-12-06 20:54:08
阅读次数:
195
import nltk from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer #预处理 def preprocessing(text): tokens=[word for sent in nltk.sent... ...
分类:
其他好文 时间:
2018-12-06 11:05:02
阅读次数:
174
# 若没有nltk则先定义一个空函数 def pre(text): pre_text=text return pre_text #读取数据 import csv # with open(r'd:/SMSSpamCollectionjsn.txt',encoding = "utf-8")as file... ...
分类:
其他好文 时间:
2018-12-03 16:36:03
阅读次数:
232
import nltk from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer import csv import numpy as np from sklearn.model_selection impor... ...
分类:
其他好文 时间:
2018-12-03 15:21:56
阅读次数:
125
import nltk from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer def preprocessing(text): tokens=[word for sent in nltk.sent_toke... ...
分类:
其他好文 时间:
2018-12-03 12:50:13
阅读次数:
132
!pip install nltk #读取文件 text = 'Be assured that individual statistics are not disclosed and this is for internal use only..I am pleased to inform you ... ...
分类:
其他好文 时间:
2018-11-29 15:38:45
阅读次数:
265
三、 垃圾邮件分类 数据准备: 用csv读取邮件数据,分解出邮件类别及邮件内容。 对邮件内容进行预处理:去掉长度小于3的词,去掉没有语义的词等 尝试使用nltk库: pip install nltk nltk.download 不成功:就使用词频统计的处理方法 训练集和测试集数据划分 from sk... ...
分类:
其他好文 时间:
2018-11-29 15:16:44
阅读次数:
218
import nltk nltk.download() from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer #预处理 def preprocessing(text): tokens = [word for... ...
分类:
其他好文 时间:
2018-11-29 15:01:31
阅读次数:
474
在不能上网的服务器上把nltk_data关联到python3,已经安装anaconda3所以不需要安装nltk,环境是linux 首先没有nltk_data在使用nltk会报错 1.下载nltk_data https://github.com/nltk/nltk_data 里面的Packages就是 ...
分类:
编程语言 时间:
2018-11-21 12:16:33
阅读次数:
1023
首先要了解python的基本语法, 其中列表的处理,字符串的格式化,以及词汇的比较运算(包括判断某一个词语开头是否大小写等) 专有名词: 1. 分词:用于产生词汇和标点符号的链表 安装完NlLTK后, import nltk nltk.download() 计算text1中每个词的平均出现次数公式: ...
分类:
其他好文 时间:
2018-11-18 22:33:39
阅读次数:
397