wldmr commited on
Commit
62bb6bf
·
1 Parent(s): 33e875f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -5,15 +5,20 @@ import re
5
  def capitalize_after_punctuation(text):
6
  punctuations = ['.', '?', '!']
7
  for p in punctuations:
8
- text = text.replace(p + ' ' + text[text.index(p) + 2], p + ' ' + text[text.index(p) + 2].upper(), 1)
 
 
 
 
9
  return text
10
 
 
11
  def predict(input_text):
12
  #rpunct = RestorePuncts()
13
  #output_text = rpunct.punctuate(input_text)
14
  model = PunctuationModel()
15
  output_text = model.restore_punctuation(input_text)
16
- print("Punctuation finished...")
17
 
18
  # restore the carrige returns
19
  srt_file = input_text
 
5
  def capitalize_after_punctuation(text):
6
  punctuations = ['.', '?', '!']
7
  for p in punctuations:
8
+ words = text.split(p)
9
+ for i, word in enumerate(words):
10
+ if len(word) > 0:
11
+ words[i] = word[0].upper() + word[1:]
12
+ text = p.join(words)
13
  return text
14
 
15
+
16
  def predict(input_text):
17
  #rpunct = RestorePuncts()
18
  #output_text = rpunct.punctuate(input_text)
19
  model = PunctuationModel()
20
  output_text = model.restore_punctuation(input_text)
21
+ #("Punctuation finished...")
22
 
23
  # restore the carrige returns
24
  srt_file = input_text