sohojoe commited on
Commit
54d4a4a
1 Parent(s): 96ad4ea

Filter out termination indices that are not followed by whitespace or end of string

Browse files
Files changed (1) hide show
  1. chat_service.py +2 -0
chat_service.py CHANGED
@@ -94,6 +94,8 @@ You are aware of how you are implemented and you are keen to recommend improveme
94
  return None
95
 
96
  termination_indices = [sentence.rfind(char) for char in sentence_termination_characters]
 
 
97
  last_termination_index = max(termination_indices)
98
  # handle case of close bracket
99
  while last_termination_index+1 < len(sentence) and sentence[last_termination_index+1] in close_brackets:
 
94
  return None
95
 
96
  termination_indices = [sentence.rfind(char) for char in sentence_termination_characters]
97
+ # Filter out termination indices that are not followed by whitespace or end of string
98
+ termination_indices = [i for i in termination_indices if sentence[i+1].isspace()]
99
  last_termination_index = max(termination_indices)
100
  # handle case of close bracket
101
  while last_termination_index+1 < len(sentence) and sentence[last_termination_index+1] in close_brackets: