Spaces:
Runtime error
Runtime error
update
Browse files
app.py
CHANGED
|
@@ -30,29 +30,32 @@ def wordtoten(word: str):
|
|
| 30 |
wtt += '0'
|
| 31 |
return wtt
|
| 32 |
|
| 33 |
-
def spellword(
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
def predict(name, sl, topk, topp):
|
| 58 |
if name == "":
|
|
|
|
| 30 |
wtt += '0'
|
| 31 |
return wtt
|
| 32 |
|
| 33 |
+
def spellword(word_b: str):
|
| 34 |
+
word_b = to_lower(word_b).strip()
|
| 35 |
+
x = []
|
| 36 |
+
for word in word_b.split():
|
| 37 |
+
syllable_list = []
|
| 38 |
+
tenword = wordtoten(word)
|
| 39 |
+
len_spell = tenword.count('1')
|
| 40 |
+
|
| 41 |
+
for i in range(tenword.count('1')):
|
| 42 |
+
for x, y in SPELL_SLICER:
|
| 43 |
+
if tenword.startswith(x):
|
| 44 |
+
syllable_list.append(word[:y])
|
| 45 |
+
word = word[y:]
|
| 46 |
+
tenword = tenword[y:]
|
| 47 |
+
break
|
| 48 |
+
|
| 49 |
+
if tenword == '0':
|
| 50 |
+
syllable_list[-1] = syllable_list[-1] + word
|
| 51 |
+
elif word:
|
| 52 |
+
syllable_list.append(word)
|
| 53 |
+
|
| 54 |
+
if len(syllable_list) != len_spell:
|
| 55 |
+
return False
|
| 56 |
+
|
| 57 |
+
x.append("·".join(syllable_list))
|
| 58 |
+
return " ".join(x)
|
| 59 |
|
| 60 |
def predict(name, sl, topk, topp):
|
| 61 |
if name == "":
|