hobs commited on
Commit
a09a83f
1 Parent(s): 6cb7f39
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -4,6 +4,10 @@ from gradio import routes
4
  from typing import List, Type
5
 
6
 
 
 
 
 
7
  def text2int(text, numwords={}):
8
  """ Convert an English str containing number words into an int
9
 
@@ -34,6 +38,7 @@ def text2int(text, numwords={}):
34
  numwords[word] = (10 ** (idx * 3 or 2), 0)
35
 
36
  current = result = 0
 
37
  for word in text.split():
38
  if word not in numwords:
39
  raise Exception("Illegal word: " + word)
 
4
  from typing import List, Type
5
 
6
 
7
+ def normalize_text(text):
8
+ return text.replace('-', ' ')
9
+
10
+
11
  def text2int(text, numwords={}):
12
  """ Convert an English str containing number words into an int
13
 
 
38
  numwords[word] = (10 ** (idx * 3 or 2), 0)
39
 
40
  current = result = 0
41
+ text = normalize_text(text)
42
  for word in text.split():
43
  if word not in numwords:
44
  raise Exception("Illegal word: " + word)