Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.75 KB | None | 0 0
  1. ValueError                                Traceback (most recent call last)
  2. <ipython-input-31-ccf731433f59> in <module>
  3.       1 arr = ['foo', 'bar']
  4.       2 data = np.array(arr)
  5. ----> 3 CountVectorizer(data).fit(data)
  6.  
  7. ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in fit(self, raw_documents, y)
  8.    1022         self
  9.    1023         """
  10. -> 1024         self.fit_transform(raw_documents)
  11.   1025         return self
  12.   1026
  13.  
  14. ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in fit_transform(self, raw_documents, y)
  15.   1056
  16.   1057         vocabulary, X = self._count_vocab(raw_documents,
  17. -> 1058                                           self.fixed_vocabulary_)
  18.   1059
  19.   1060         if self.binary:
  20.  
  21. ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in _count_vocab(self, raw_documents, fixed_vocab)
  22.    968         for doc in raw_documents:
  23.    969             feature_counter = {}
  24. --> 970             for feature in analyze(doc):
  25.    971                 try:
  26.    972                     feature_idx = vocabulary[feature]
  27.  
  28. ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in <lambda>(doc)
  29.    350                                                tokenize)
  30.    351             return lambda doc: self._word_ngrams(
  31. --> 352                 tokenize(preprocess(self.decode(doc))), stop_words)
  32.    353
  33.    354         else:
  34.  
  35. ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in decode(self, doc)
  36.    130             The string to decode
  37.    131         """
  38. --> 132         if self.input == 'filename':
  39.     133             with open(doc, 'rb') as fh:
  40.     134                 doc = fh.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement