---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-58-02293a80fac7> in <module>()
2 data = json.loads(f.read())
3 documents = [x['description'] for x in data]
----> 4 dictionary = corpora.Dictionary(doc for doc in documents)
5 dictionary.filter_extremes(no_below=5, no_above=0.5, keep_n=100000)
6 stop_ids = [dictionary.token2id[stopword] for stopword in stoplist if stopword in dictionary.token2id]
/usr/local/lib/python2.7/dist-packages/gensim/corpora/dictionary.pyc in __init__(self, documents, prune_at)
56
57 if documents is not None:
---> 58 self.add_documents(documents, prune_at=prune_at)
59
60
/usr/local/lib/python2.7/dist-packages/gensim/corpora/dictionary.pyc in add_documents(self, documents, prune_at)
125
126 # update Dictionary with the document
--> 127 self.doc2bow(document, allow_update=True) # ignore the result, here we only care about updating token ids
128
129 logger.info("built %s from %i documents (total %i corpus positions)",
/usr/local/lib/python2.7/dist-packages/gensim/corpora/dictionary.pyc in doc2bow(self, document, allow_update, return_missing)
147 """
148 if isinstance(document, string_types):
--> 149 raise TypeError("doc2bow expects an array of unicode tokens on input, not a single string")
150
151 # Construct (word, frequency) mapping.
TypeError: doc2bow expects an array of unicode tokens on input, not a single string