shuyuej commited on
Commit
59a1bbb
·
1 Parent(s): b3b6460

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -0
README.md CHANGED
@@ -60,6 +60,19 @@ def clean_up(sentence):
60
  elif index > 0 and index < len(sentence) - 1 and sentence[index - 1] == ' ' and sentence[index + 1] != ' ':
61
  sentence = sentence[:index] + sentence[index] + ' ' + sentence[index + 1:]
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  ##############################################################################################################
64
  # Find all occurrences of "+"
65
  asterisks = [i for i, char in enumerate(sentence) if char == '+']
@@ -108,6 +121,12 @@ def clean_up(sentence):
108
  if sentence[dot_location - 1].isspace() and sentence[dot_location + 1].isdigit():
109
  sentence = sentence[:dot_location] + '0' + sentence[dot_location:]
110
 
 
 
 
 
 
 
111
  return sentence
112
 
113
 
 
60
  elif index > 0 and index < len(sentence) - 1 and sentence[index - 1] == ' ' and sentence[index + 1] != ' ':
61
  sentence = sentence[:index] + sentence[index] + ' ' + sentence[index + 1:]
62
 
63
+ ##############################################################################################################
64
+ # # Find all occurrences of "/"
65
+ # asterisks = [i for i, char in enumerate(sentence) if char == '/']
66
+ #
67
+ # # Check and add spaces around "/"
68
+ # for index in reversed(asterisks):
69
+ # if index > 0 and index < len(sentence) - 1 and sentence[index - 1] != ' ' and sentence[index + 1] != ' ':
70
+ # sentence = sentence[:index] + ' ' + sentence[index] + ' ' + sentence[index + 1:]
71
+ # elif index > 0 and index < len(sentence) - 1 and sentence[index - 1] != ' ' and sentence[index + 1] == ' ':
72
+ # sentence = sentence[:index] + ' ' + sentence[index] + sentence[index + 1:]
73
+ # elif index > 0 and index < len(sentence) - 1 and sentence[index - 1] == ' ' and sentence[index + 1] != ' ':
74
+ # sentence = sentence[:index] + sentence[index] + ' ' + sentence[index + 1:]
75
+
76
  ##############################################################################################################
77
  # Find all occurrences of "+"
78
  asterisks = [i for i, char in enumerate(sentence) if char == '+']
 
121
  if sentence[dot_location - 1].isspace() and sentence[dot_location + 1].isdigit():
122
  sentence = sentence[:dot_location] + '0' + sentence[dot_location:]
123
 
124
+ ##############################################################################################################
125
+ # Check if there is a "." before "\n#### "
126
+ if ".\n#### " not in sentence:
127
+ # If not, add a "."
128
+ sentence = sentence.replace("\n#### ", ".\n#### ")
129
+
130
  return sentence
131
 
132