0
from sklearn.feature_extraction.text import TfidfVectorizer
transformer = TfidfVectorizer(stop_words="english")
word_data_trans = transformer.fit_transform(word_data)

I'm getting error like this:

79 from sklearn.feature_extraction.text import TfidfVectorizer
     80 transformer = TfidfVectorizer(stop_words="english")
---> 81 word_data_trans = transformer.fit_transform(word_data)
     82 word_list = transformer.get_feature_names()
     83 print "Length of word_list: ", len(word_list)

C:\ProgramData\Anaconda3\envs\ipykernel_py2\lib\site-packages\sklearn\feature_extraction\text.pyc in fit_transform(self, raw_documents, y)
   1379             Tf-idf-weighted document-term matrix.
   1380         """
-> 1381         X = super(TfidfVectorizer, self).fit_transform(raw_documents)
   1382         self._tfidf.fit(X)
   1383         # X is already a transformed view of raw_documents so

i don't know what i'm not doing right here

arian
  • 41
  • 1
  • 11
  • Is this the same problem? [https://stackoverflow.com/questions/20928769/python-tfidfvectorizer-throwing-empty-vocabulary-perhaps-the-documents-only-c](https://stackoverflow.com/questions/20928769/python-tfidfvectorizer-throwing-empty-vocabulary-perhaps-the-documents-only-c) – Jarad Aug 09 '18 at 15:47
  • 1
    Could you post a sample of `word_data`? and the full error message if possible. – Qusai Alothman Aug 10 '18 at 00:39

0 Answers0