Spaces:
Sleeping
Sleeping
Update tweet_analyzer.py
Browse files- tweet_analyzer.py +2 -1
tweet_analyzer.py
CHANGED
@@ -116,7 +116,8 @@ class TweetDatasetProcessor:
|
|
116 |
nmf_model.fit(tfidf_matrix)
|
117 |
topics = []
|
118 |
for topic_idx, topic in enumerate(nmf_model.components_):
|
119 |
-
topic_words = [vectorizer.get_feature_names_out()[i]
|
|
|
120 |
topics.append(" ".join(topic_words))
|
121 |
return topics
|
122 |
|
|
|
116 |
nmf_model.fit(tfidf_matrix)
|
117 |
topics = []
|
118 |
for topic_idx, topic in enumerate(nmf_model.components_):
|
119 |
+
topic_words = [vectorizer.get_feature_names_out()[i]
|
120 |
+
for i in topic.argsort()[:-n_topics - 1:-1]]
|
121 |
topics.append(" ".join(topic_words))
|
122 |
return topics
|
123 |
|