Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -58,6 +58,30 @@ def display_context_graph(context_words):
|
|
58 |
graph = create_context_graph(context_words)
|
59 |
st.graphviz_chart(graph)
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
def display_context_table(context_words):
|
62 |
table = "| Before | High Info Word | After |\n|--------|----------------|-------|\n"
|
63 |
for before, high, after in context_words:
|
@@ -93,9 +117,4 @@ if file_text:
|
|
93 |
st.markdown("**Relationship Graph:**")
|
94 |
display_relationship_graph(top_words)
|
95 |
|
96 |
-
context_words = extract_context_words(text_without_timestamps, top_words
|
97 |
-
st.markdown("**Context Graph:**")
|
98 |
-
display_context_graph(context_words)
|
99 |
-
|
100 |
-
st.markdown("**Context Table:**")
|
101 |
-
display_context_table(context_words)
|
|
|
58 |
graph = create_context_graph(context_words)
|
59 |
st.graphviz_chart(graph)
|
60 |
|
61 |
+
def create_combined_context_graph(context_words, high_information_words):
|
62 |
+
graph = Digraph()
|
63 |
+
|
64 |
+
# Create nodes for high information words
|
65 |
+
for word in high_information_words:
|
66 |
+
graph.node(word, shape='ellipse')
|
67 |
+
|
68 |
+
for before_word, high_info_word, after_word in context_words:
|
69 |
+
# Connect before_word to high_info_word
|
70 |
+
if before_word:
|
71 |
+
graph.node(before_word, shape='box' if before_word not in high_information_words else 'ellipse')
|
72 |
+
graph.edge(before_word, high_info_word)
|
73 |
+
|
74 |
+
# Connect high_info_word to after_word
|
75 |
+
if after_word:
|
76 |
+
graph.node(after_word, shape='box' if after_word not in high_information_words else 'ellipse')
|
77 |
+
graph.edge(high_info_word, after_word)
|
78 |
+
|
79 |
+
return graph
|
80 |
+
|
81 |
+
def display_combined_context_graph(context_words, high_information_words):
|
82 |
+
graph = create_combined_context_graph(context_words, high_information_words)
|
83 |
+
st.graphviz_chart(graph)
|
84 |
+
|
85 |
def display_context_table(context_words):
|
86 |
table = "| Before | High Info Word | After |\n|--------|----------------|-------|\n"
|
87 |
for before, high, after in context_words:
|
|
|
117 |
st.markdown("**Relationship Graph:**")
|
118 |
display_relationship_graph(top_words)
|
119 |
|
120 |
+
context_words = extract_context_words(text_without_timestamps, top_words
|
|
|
|
|
|
|
|
|
|