Update app.py
Browse files
app.py
CHANGED
@@ -31,13 +31,21 @@ top_words = word_frequency.most_common(10)
|
|
31 |
top_words_dict = dict(top_words)
|
32 |
|
33 |
# Create a Plotly bar chart to display the top words and their frequency
|
34 |
-
|
35 |
-
st.plotly_chart(
|
36 |
|
37 |
# Calculate the scores for each word based on their length
|
38 |
word_scores = {word:get_word_score(word) for word in word_frequency}
|
39 |
top_word_scores = dict(sorted(word_scores.items(), key=lambda item: item[1], reverse=True)[:10])
|
40 |
|
41 |
# Create a Plotly bar chart to display the top words and their scores
|
42 |
-
|
43 |
-
st.plotly_chart(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
top_words_dict = dict(top_words)
|
32 |
|
33 |
# Create a Plotly bar chart to display the top words and their frequency
|
34 |
+
fig_bar = px.bar(x=list(top_words_dict.keys()), y=list(top_words_dict.values()), labels={'x':'Word', 'y':'Frequency'})
|
35 |
+
st.plotly_chart(fig_bar)
|
36 |
|
37 |
# Calculate the scores for each word based on their length
|
38 |
word_scores = {word:get_word_score(word) for word in word_frequency}
|
39 |
top_word_scores = dict(sorted(word_scores.items(), key=lambda item: item[1], reverse=True)[:10])
|
40 |
|
41 |
# Create a Plotly bar chart to display the top words and their scores
|
42 |
+
fig_score = px.bar(x=list(top_word_scores.keys()), y=list(top_word_scores.values()), labels={'x':'Word', 'y':'Score'})
|
43 |
+
st.plotly_chart(fig_score)
|
44 |
+
|
45 |
+
# Create a treemap chart to display the word frequency
|
46 |
+
fig_treemap = px.treemap(values=list(top_words_dict.values()), labels=list(top_words_dict.keys()))
|
47 |
+
st.plotly_chart(fig_treemap)
|
48 |
+
|
49 |
+
# Create a sunburst chart to display the word scores
|
50 |
+
fig_sunburst = px.sunburst(values=list(top_word_scores.values()), labels=list(top_word_scores.keys()))
|
51 |
+
st.plotly_chart(fig_sunburst)
|