mirror of
https://github.com/marvinscham/masterthesis-playground.git
synced 2026-03-22 08:22:43 +01:00
22.02.
This commit is contained in:
@@ -360,7 +360,6 @@ vis = topic_model.visualize_documents(
|
||||
custom_labels=True,
|
||||
hide_annotations=True,
|
||||
)
|
||||
# vis.write_html("output/visualization.html")
|
||||
vis
|
||||
|
||||
# %%
|
||||
@@ -497,7 +496,12 @@ if CALCULATE_TOKEN_DISTRIBUTIONS:
|
||||
#
|
||||
|
||||
# %%
|
||||
topic_model.visualize_hierarchy(custom_labels=True)
|
||||
topic_model.visualize_hierarchy(custom_labels=True, color_threshold=0.98)
|
||||
|
||||
# %%
|
||||
hierarchical_topics = topic_model.hierarchical_topics(reviews)
|
||||
tree = topic_model.get_topic_tree(hier_topics=hierarchical_topics)
|
||||
print(tree)
|
||||
|
||||
# %% [markdown]
|
||||
# ### Intertopic Distance Map
|
||||
@@ -512,3 +516,20 @@ topic_model.visualize_topics(use_ctfidf=True)
|
||||
|
||||
# %%
|
||||
topic_model.visualize_barchart(top_n_topics=12, custom_labels=True, n_words=10)
|
||||
|
||||
# %%
|
||||
from wordcloud import WordCloud
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
def create_wordcloud(model, topic):
|
||||
text = {word: value for word, value in model.get_topic(topic)}
|
||||
wc = WordCloud(background_color="white", max_words=1000)
|
||||
wc.generate_from_frequencies(text)
|
||||
plt.imshow(wc, interpolation="bilinear")
|
||||
plt.axis("off")
|
||||
plt.show()
|
||||
|
||||
|
||||
# Show wordcloud
|
||||
create_wordcloud(topic_model, topic=1)
|
||||
|
||||
Reference in New Issue
Block a user