Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
sentence in quotes fix
Browse files
resources/app/python/xvapitch/text/text_preprocessing.py
CHANGED
|
@@ -418,7 +418,19 @@ class TextPreprocessor():
|
|
| 418 |
|
| 419 |
|
| 420 |
def clean_special_chars(self, text):
|
| 421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
|
| 423 |
def text_to_phonemes (self, text):
|
| 424 |
text = self.clean_special_chars(text)
|
|
|
|
| 418 |
|
| 419 |
|
| 420 |
def clean_special_chars(self, text):
|
| 421 |
+
# quotemarks " can create problems for dict_replace
|
| 422 |
+
# remove the ones at start and end of text
|
| 423 |
+
if text.strip()[0]:\
|
| 424 |
+
text = text.replace("\"", "", 1)
|
| 425 |
+
if text.strip()[-1]:\
|
| 426 |
+
text = text[::-1].replace("\"", "", 1)[::-1]
|
| 427 |
+
# replace all others with a colon
|
| 428 |
+
text = text.replace("\"", ":")
|
| 429 |
+
|
| 430 |
+
# remove asterisks
|
| 431 |
+
text.replace("*","")
|
| 432 |
+
|
| 433 |
+
return text
|
| 434 |
|
| 435 |
def text_to_phonemes (self, text):
|
| 436 |
text = self.clean_special_chars(text)
|