wldmr commited on
Commit
816be8b
·
1 Parent(s): 4d06f4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -37,13 +37,11 @@ def predict(input_text):
37
  # assemble the array back to a string
38
  pcnt_file_cr=' '.join(pcnt_file_array_hash).replace('#','\n')
39
 
40
-
41
- p = re.compile(r'(?<=[\.\?!]\s)(\w+)')
42
- pcnt_file_cr_cap = p.sub(cap, pcnt_file_cr)
43
 
44
- pcnt_file_cr_capi = pcnt_file_cr_cap.replace(' i ',' I ')
45
-
46
- return pcnt_file_cr_capi
47
 
48
  if __name__ == "__main__":
49
 
 
37
  # assemble the array back to a string
38
  pcnt_file_cr=' '.join(pcnt_file_array_hash).replace('#','\n')
39
 
40
+ regex1 = r"\bi\b"
41
+ regex2 = r"(?<=[.?!]|\n)\s*\w"
42
+ pcnt_file_cr_cap = re.sub(regex2, lambda x: x.group().upper(), re.sub(regex1, "I", pcnt_file_cr))
43
 
44
+ return pcnt_file_cr_cap
 
 
45
 
46
  if __name__ == "__main__":
47