Towhidul commited on
Commit
793fbc5
1 Parent(s): 4934dc4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -68,7 +68,7 @@ def paraphrase(
68
 
69
  def remove_punctuations(text):
70
  # Remove punctuations while preserving hyphenated words
71
- return re.sub(r'(?<!\w)-|-(?!\w)', ' ', re.sub(r'[^\w\s,-]', '', text))
72
 
73
  def tokenize(sentence):
74
  # Remove punctuations using the updated function and tokenize the sentence into words
@@ -293,6 +293,18 @@ for sentence in highlighted_sentence_list:
293
 
294
 
295
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
 
298
 
 
68
 
69
  def remove_punctuations(text):
70
  # Remove punctuations while preserving hyphenated words
71
+ return re.sub(r'(?<!\w)-|-(?!\w)', ' ', re.sub(r'[^\w\s-]', '', text))
72
 
73
  def tokenize(sentence):
74
  # Remove punctuations using the updated function and tokenize the sentence into words
 
293
 
294
 
295
 
296
+ highlighted_main_sentence = main_sentence
297
+
298
+ # Iterate through each paraphrase and apply different colors to combined words
299
+ for i, combined_words in enumerate(combined_words_list):
300
+ color = colors[i % len(colors)] # Get color for this paraphrase
301
+ # Highlight combined words from this paraphrase with the corresponding color
302
+ for substring in combined_words:
303
+ highlighted_main_sentence = highlighted_main_sentence.replace(substring, f'<span style="background-color: {color}; color: white;">{substring}</span>')
304
+
305
+ st.markdown("\nHighlighted Main Sentence with LCS from All Paraphrases:")
306
+ st.write(highlighted_main_sentence, unsafe_allow_html=True)
307
+
308
 
309
 
310