这是我的密码
CSV文件的URL:https://github.com/eugeneketeni/web-mining-final-project/blob/master/Test_file.csv
import pandas as pd
data = pd.read_csv("https://raw.githubusercontent.com/eugeneketeni/web-
mining-final-project/master/Test_file.csv")
import nltk
from nltk import word_tokenize, sent_tokenize
data['text'] = data.loc[:, 'text'].astype(str)
text = data.loc[:, "text"].astype(str)
tokenizer = [word_tokenize(text[i]) for i in range(len(text))]
print(tokenizer)
filtered_sentence = []
from nltk.corpus import stopwords
stopwords = set(stopwords.words('english'))
filtered_sentence = [w for w in tokenizer if not w in stopwords]
print(filtered_sentence)
我的标记器可以工作,但是当我试图删除默认的非索引字时,我总是收到“unhable type:'list'”错误。我不知道到底发生了什么。我会很感激你的帮助。谢谢。在
TL;DR
很长时间内
请参见Why is my NLTK function slow when processing the DataFrame?了解有关以下内容的详细说明:
为了更好,twitter文本处理
^{pr2}$然后使用这个:
从自然语言库导入非索引字
相关问题 更多 >
编程相关推荐