ECUiVADE commited on
Commit
a5a598a
1 Parent(s): 894e633

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -94,11 +94,10 @@ class ChatbotAPP:
94
  def strip_text(self, text):
95
  # Pattern to match text inside parentheses or angle brackets, any text following angle brackets,
96
  # new line characters, and anything after ',', '<', or '|'
97
- patterns = [r"\(.*?\)|<.*?>.*|\n|\s{3,}", re.escape("im_start") , re.escape("im_end")]
98
- combined_pattern = "|".join(patterns)
99
  # Use re.sub() to replace the matched text with an empty string
100
- cleaned_text = re.sub(patterns, "", text)
101
-
102
  return cleaned_text
103
 
104
  def upload_to_google_drive(self): # Method to upload the current chat log to Google Drive
 
94
  def strip_text(self, text):
95
  # Pattern to match text inside parentheses or angle brackets, any text following angle brackets,
96
  # new line characters, and anything after ',', '<', or '|'
97
+ pattern = r"\(.*?\)|<.*?>.*|\n|\s{3,}"
 
98
  # Use re.sub() to replace the matched text with an empty string
99
+ cleaned_text = re.sub(pattern, "", text)
100
+ cleaned_text = cleaned_text.replace(im_start, "").replace(im_end, "")
101
  return cleaned_text
102
 
103
  def upload_to_google_drive(self): # Method to upload the current chat log to Google Drive