Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ValueError Traceback (most recent call last)
- <ipython-input-31-ccf731433f59> in <module>
- 1 arr = ['foo', 'bar']
- 2 data = np.array(arr)
- ----> 3 CountVectorizer(data).fit(data)
- ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in fit(self, raw_documents, y)
- 1022 self
- 1023 """
- -> 1024 self.fit_transform(raw_documents)
- 1025 return self
- 1026
- ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in fit_transform(self, raw_documents, y)
- 1056
- 1057 vocabulary, X = self._count_vocab(raw_documents,
- -> 1058 self.fixed_vocabulary_)
- 1059
- 1060 if self.binary:
- ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in _count_vocab(self, raw_documents, fixed_vocab)
- 968 for doc in raw_documents:
- 969 feature_counter = {}
- --> 970 for feature in analyze(doc):
- 971 try:
- 972 feature_idx = vocabulary[feature]
- ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in <lambda>(doc)
- 350 tokenize)
- 351 return lambda doc: self._word_ngrams(
- --> 352 tokenize(preprocess(self.decode(doc))), stop_words)
- 353
- 354 else:
- ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in decode(self, doc)
- 130 The string to decode
- 131 """
- --> 132 if self.input == 'filename':
- 133 with open(doc, 'rb') as fh:
- 134 doc = fh.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement