I'm trying to implement the Naive Bayes classifier on tweets using TextBlob in python. I have been able to train the dataset and can successfully classify individual tweets using:
print cl.classify("text")
Now I want to open a csv file and classify all the tweets in that file. Any suggestions on how I can achieve this? My code is as below:
import csv
from textblob import TextBlob
with open(test_path, 'rU') as csvfile:
lineReader = csv.reader(csvfile,delimiter=',',quotechar="\"")
lineReader = csv.reader(csvfile,delimiter=',')
test = []
for row in lineReader:
blob = (row[0])
blob = TextBlob(blob)
test.append([blob])
print (test.classify())
AttributeError: 'list' object has no attribute 'classify'
classify()onlist. you should do that to theblob- Vaishak Suresh