Spaces:
Sleeping
Sleeping
GuysRGithub
commited on
Commit
·
7ddc82f
1
Parent(s):
fd1accb
Update
Browse files
app.py
CHANGED
|
@@ -27,12 +27,13 @@ map_words = {
|
|
| 27 |
}
|
| 28 |
|
| 29 |
word_remove_sentence = [
|
| 30 |
-
"
|
| 31 |
-
"
|
| 32 |
-
"
|
| 33 |
-
"
|
| 34 |
-
"
|
| 35 |
-
"
|
|
|
|
| 36 |
]
|
| 37 |
|
| 38 |
|
|
@@ -145,16 +146,16 @@ def chat():
|
|
| 145 |
|
| 146 |
def post_process(output):
|
| 147 |
|
| 148 |
-
output = textwrap.fill(textwrap.dedent(output).strip(), width=120)
|
| 149 |
-
|
| 150 |
# print(lines)
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
|
| 157 |
-
|
| 158 |
for item in map_words.keys():
|
| 159 |
output = re.sub(item, map_words[item], output, re.I)
|
| 160 |
|
|
|
|
| 27 |
}
|
| 28 |
|
| 29 |
word_remove_sentence = [
|
| 30 |
+
"Hello and Welcome to",
|
| 31 |
+
# "hello",
|
| 32 |
+
# "hi",
|
| 33 |
+
# "regards",
|
| 34 |
+
# "dr.",
|
| 35 |
+
# "physician",
|
| 36 |
+
# "welcome",
|
| 37 |
]
|
| 38 |
|
| 39 |
|
|
|
|
| 146 |
|
| 147 |
def post_process(output):
|
| 148 |
|
| 149 |
+
# output = textwrap.fill(textwrap.dedent(output).strip(), width=120)
|
| 150 |
+
lines = output.split(".")
|
| 151 |
# print(lines)
|
| 152 |
+
for line in lines:
|
| 153 |
+
for word in word_remove_sentence:
|
| 154 |
+
if word in line.lower():
|
| 155 |
+
lines.remove(line)
|
| 156 |
+
break
|
| 157 |
|
| 158 |
+
output = ".".join(lines)
|
| 159 |
for item in map_words.keys():
|
| 160 |
output = re.sub(item, map_words[item], output, re.I)
|
| 161 |
|