So I have the following list of lists which is tokenized:
tokenized_list = [['ALL', 'MY', 'CATS', 'IN', 'A', 'ROW'], ['WHEN', 'MY',
'CAT', 'SITS', 'DOWN', ',', 'SHE', 'LOOKS', 'LIKE', 'A',
'FURBY', 'TOY', '!'], ['THE', CAT', 'FROM', 'OUTER',
'SPACE'], ['SUNSHINE', 'LOVES', 'TO', 'SIT',
'LIKE', 'THIS', 'FOR', 'SOME', 'REASON', '.']]
When i try to vectorize it using the CountVectorizer() or TfIdfVectorizer()
from sklearn.feature_extraction.text import CountVectorizer
vectorizer = CountVectorizer()
print(vectorizer.fit_transform(tokenized_list).todense())
print(vectorizer.vocabulary_)
I am getting the following error:
AttributeError: 'list' object has no attribute 'lower'
And if I put a simple list inside the vectorizer.fit_transform() function it works properly.
How do I remove this error?