Towhidul commited on
Commit
7b1a737
1 Parent(s): 36267fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
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
@@ -264,20 +264,20 @@ st.markdown("\nHighlighted Main Sentence with LCS:")
264
  st.write(highlighted_sentence, unsafe_allow_html=True)
265
 
266
 
267
- highlighted_sentence = paraphrases[0]
268
- highlighted_text = []
269
-
270
- for substring in combined_words_list[0]:
271
- highlighted_sentence = highlighted_sentence.replace(substring, f'<span style="background-color: blue; color: white;">{substring}</span>')
272
- highlighted_text.append(substring)
273
 
274
- st.markdown("Common substrings between main_sentence and Paraphrase1:")
 
 
275
 
276
- # for substring in highlighted_text:
277
- # st.write(substring)
 
 
 
278
 
279
- st.markdown("\nHighlighted Main Sentence with LCS:")
280
- st.write(highlighted_sentence, unsafe_allow_html=True)
281
 
282
 
283
 
 
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
 
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
+ st.write(highlighted_sentence_list, unsafe_allow_html=True)
281
 
282
 
283