dlab-berkeley / Python-Text-Analysis-Legacy-2023

D-Lab's 12 hour introduction to text analysis with Python. Learn how to perform bag-of-words, sentiment analysis, topic modeling, word embeddings, and more, using scikit-learn, NLTK, Gensim, and spaCy in Python.
Creative Commons Attribution 4.0 International
22 stars 9 forks source link

Attribute Error in Topic Modeling Lesson #31

Open rbarreto opened 1 year ago

rbarreto commented 1 year ago

Code that generates error: tfidf = vectorizer.fit_transform(data) tokens = vectorizer.get_feature_names_out()

Error: Attribute Error: tfidfvectorizer does not have attribute 'get_feature_names_out'

pssachdeva commented 1 year ago

You need to update your version of scikit-learn. They changed the name of the function from get_feature_names() to get_feature_names_out().