Towhidul commited on
Commit
35c17fa
·
verified ·
1 Parent(s): 9806f7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -6
app.py CHANGED
@@ -167,6 +167,10 @@ st.write(main_sentence)
167
  # Generate paraphrases
168
  paraphrases = paraphrase(main_sentence)
169
 
 
 
 
 
170
  matching_bigrams_list = []
171
  combined_words_list = []
172
 
@@ -260,25 +264,31 @@ st.markdown("Common substrings that occur in all five lists:")
260
  for substring in highlighted_text:
261
  st.write(substring)
262
 
263
- st.markdown("\nHighlighted Main Sentence with LCS:")
264
  st.write(highlighted_sentence, unsafe_allow_html=True)
265
 
266
 
267
  highlighted_sentence_list = []
268
 
 
 
 
269
  for i in range(0, 5):
270
  highlighted_sentence = paraphrases[i]
271
  highlighted_text = []
272
 
273
- for substring in combined_words_list[i]:
274
- highlighted_sentence = highlighted_sentence.replace(substring, f'<span style="background-color: blue; color: white;">{substring}</span>')
 
 
275
  highlighted_text.append(substring)
276
 
277
  highlighted_sentence_list.append(highlighted_sentence)
278
 
279
- st.markdown("\nHighlighted Paraphrase Sentences with LCS:")
280
- for i in highlighted_sentence_list:
281
- st.write(i, unsafe_allow_html=True)
 
282
 
283
 
284
 
 
167
  # Generate paraphrases
168
  paraphrases = paraphrase(main_sentence)
169
 
170
+ st.markdown("**Paraphrase Sentences**:")
171
+ for i in paraphrases:
172
+ st.write(i)
173
+
174
  matching_bigrams_list = []
175
  combined_words_list = []
176
 
 
264
  for substring in highlighted_text:
265
  st.write(substring)
266
 
267
+ st.markdown("**\nHighlighted Main Sentence with LCS:**")
268
  st.write(highlighted_sentence, unsafe_allow_html=True)
269
 
270
 
271
  highlighted_sentence_list = []
272
 
273
+ # Define colors for highlighting
274
+ colors = ['blue', 'green', 'orange', 'purple', 'red']
275
+
276
  for i in range(0, 5):
277
  highlighted_sentence = paraphrases[i]
278
  highlighted_text = []
279
 
280
+ # Iterate over substrings and apply different colors
281
+ for j, substring in enumerate(combined_words_list[i]):
282
+ color = colors[j % len(colors)] # Cycle through colors
283
+ highlighted_sentence = highlighted_sentence.replace(substring, f'<span style="background-color: {color}; color: white;">{substring}</span>')
284
  highlighted_text.append(substring)
285
 
286
  highlighted_sentence_list.append(highlighted_sentence)
287
 
288
+ st.markdown("**\nHighlighted Paraphrase Sentences with LCS:**")
289
+ for sentence in highlighted_sentence_list:
290
+ st.write(sentence, unsafe_allow_html=True)
291
+
292
 
293
 
294