bmabey/pyLDAvis

AttributeError: 'CountVectorizer' object has no attribute 'get_feature_names'

rhnprabhune opened this issue · 3 comments

sklearn version - 1.2.1
pyLDAvis version- 3.4.0
Python 3.9.13

File "C:\Users\Rohan\AppData\Local\Programs\Python\Python39\lib\site-packages\pyLDAvis\sklearn.py", line 94, in prepare
opts = fp.merge(_extract_data(lda_model, dtm, vectorizer), kwargs)
File "C:\Users\Rohan\AppData\Local\Programs\Python\Python39\lib\site-packages\pyLDAvis\sklearn.py", line 38, in _extract_data
vocab = _get_vocab(vectorizer)
File "C:\Users\Rohan\AppData\Local\Programs\Python\Python39\lib\site-packages\pyLDAvis\sklearn.py", line 20, in _get_vocab
return vectorizer.get_feature_names()
AttributeError: 'CountVectorizer' object has no attribute 'get_feature_names'

The latest release (3.4.0) source code does not have sklearn.py file

The latest release (3.4.0) source code does not have sklearn.py file

Yes, it was. Please delete sklearn.py from the directory on your machine, it was renamed to lda_model.py.

#235

Yes. Understood. This issue can be closed