shuyuej commited on
Commit
7ad97e1
·
1 Parent(s): eb958ac

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -0
README.md CHANGED
@@ -102,6 +102,15 @@ def clean_up(sentence):
102
  elif index > 0 and index < len(sentence) - 1 and sentence[index - 1] == ' ' and sentence[index + 1] != ' ':
103
  sentence = sentence[:index] + sentence[index] + ' ' + sentence[index + 1:]
104
 
 
 
 
 
 
 
 
 
 
105
  return sentence
106
 
107
 
 
102
  elif index > 0 and index < len(sentence) - 1 and sentence[index - 1] == ' ' and sentence[index + 1] != ' ':
103
  sentence = sentence[:index] + sentence[index] + ' ' + sentence[index + 1:]
104
 
105
+ ##############################################################################################################
106
+ # Find all occurrences of "."
107
+ dots_locations = [match.start() for match in re.finditer(r'\.', sentence)]
108
+
109
+ # Check and modify "." if the left side is space and the right side is a numerical number
110
+ for dot_location in reversed(dots_locations):
111
+ if sentence[dot_location - 1].isspace() and sentence[dot_location + 1].isdigit():
112
+ sentence = sentence[:dot_location] + '0' + sentence[dot_location:]
113
+
114
  return sentence
115
 
116