如果我在写这个 ::
bow_vect = CountVectorizer(max_df=0.90, min_df=2, max_features=1000, stop_words='english')
bow = bow_vect.fit_transform(combi['tidy_tweet'])
我收到这个错误::
AttributeError Traceback (most recent call last)
<ipython-input-65-745529b5930e> in <module>
1 bow_vect = CountVectorizer(max_df=0.90, min_df=2, max_features=1000, stop_words='english')
----> 2 bow = bow_vect.fit_transform(combi['tidy_tweet'])
c:\users\avinash\appdata\local\programs\python\python37\lib\site-packages\sklearn\feature_extraction\text.py in fit_transform(self, raw_documents, y)
1010
1011 vocabulary, X = self._count_vocab(raw_documents,
-> 1012 self.fixed_vocabulary_)
1013
1014 if self.binary:
c:\users\avinash\appdata\local\programs\python\python37\lib\site-packages\sklearn\feature_extraction\text.py in _count_vocab(self, raw_documents, fixed_vocab)
920 for doc in raw_documents:
921 feature_counter = {}
--> 922 for feature in analyze(doc):
923 try:
924 feature_idx = vocabulary[feature]
c:\users\avinash\appdata\local\programs\python\python37\lib\site-packages\sklearn\feature_extraction\text.py in <lambda>(doc)
306 tokenize)
307 return lambda doc: self._word_ngrams(
--> 308 tokenize(preprocess(self.decode(doc))), stop_words)
309
310 else:
c:\users\avinash\appdata\local\programs\python\python37\lib\site-packages\sklearn\feature_extraction\text.py in <lambda>(x)
254
255 if self.lowercase:
--> 256 return lambda x: strip_accents(x.lower())
257 else:
258 return strip_accents
AttributeError: 'list' object has no attribute 'lower'
HUX布斯
相关分类