Textblob在大型数据集上使用NaiveBayesAnalyzer时出现内存错误

时间:2018-11-25 12:59:25

标签: python textblob

我正在打开每个文本文件并为其分配一个标签-用来训练NaiveBayes分类器的pos或neg。该数据集包含约12,000个txt文件。我正在使用TextBlob库进行情感分析

train = [('I dont like this movie','neg')]
path  = 'C://TextDemo//senti//aclImdb//train//neg//*.txt'
for f in glob.glob(path):
with open(f, "r", encoding="UTF-8") as read_file:
    for line in read_file:
        train.append(((line.replace("<br />","")),'pos'))

cl = NaiveBayesClassifier(train)

0 个答案:

没有答案