Update app.py
Browse files
app.py
CHANGED
@@ -121,12 +121,15 @@ paraphrases = paraphrase(main_sentence)
|
|
121 |
longest_common_sequences = find_longest_common_sequences(main_sentence, paraphrases)
|
122 |
|
123 |
color_palette = ["#FF0000", "#008000", "#0000FF", "#FF00FF", "#00FFFF"]
|
124 |
-
|
125 |
-
for i, sequence in enumerate(longest_common_sequences):
|
126 |
-
color = color_palette[i % len(color_palette)]
|
127 |
-
highlighted_sentence = highlighted_sentence.replace(sequence, f"<span style='color:{color}'>{sequence}</span>")
|
128 |
-
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
# Display paraphrases with numbers
|
132 |
st.markdown("**Paraphrases**:")
|
@@ -137,4 +140,9 @@ for i, para in enumerate(paraphrases, 1):
|
|
137 |
|
138 |
# Displaying the main sentence with highlighted longest common sequences
|
139 |
st.markdown("**Main sentence with highlighted longest common sequences**:")
|
140 |
-
st.markdown(
|
|
|
|
|
|
|
|
|
|
|
|
121 |
longest_common_sequences = find_longest_common_sequences(main_sentence, paraphrases)
|
122 |
|
123 |
color_palette = ["#FF0000", "#008000", "#0000FF", "#FF00FF", "#00FFFF"]
|
124 |
+
highlighted_sentences = []
|
|
|
|
|
|
|
|
|
125 |
|
126 |
+
# Highlighting sequences in main sentence and paraphrases
|
127 |
+
for sentence in [main_sentence] + paraphrases:
|
128 |
+
highlighted_sentence = sentence
|
129 |
+
for i, sequence in enumerate(longest_common_sequences):
|
130 |
+
color = color_palette[i % len(color_palette)]
|
131 |
+
highlighted_sentence = highlighted_sentence.replace(sequence, f"<span style='color:{color}'>{sequence}</span>")
|
132 |
+
highlighted_sentences.append(highlighted_sentence)
|
133 |
|
134 |
# Display paraphrases with numbers
|
135 |
st.markdown("**Paraphrases**:")
|
|
|
140 |
|
141 |
# Displaying the main sentence with highlighted longest common sequences
|
142 |
st.markdown("**Main sentence with highlighted longest common sequences**:")
|
143 |
+
st.markdown(highlighted_sentences[0], unsafe_allow_html=True)
|
144 |
+
|
145 |
+
|
146 |
+
st.markdown("**Paraphrases with highlighted longest common sequences**:")
|
147 |
+
for paraphrase in highlighted_sentences[1:]:
|
148 |
+
st.markdown(paraphrase, unsafe_allow_html=True)
|