Update synthesize.py
Browse files- synthesize.py +4 -1
synthesize.py
CHANGED
@@ -15,7 +15,7 @@ def sanitize_filename(filename):
|
|
15 |
|
16 |
# function to add original punctuation to cotovía numbers extension (option p)
|
17 |
def punctuate_p(str_ext):
|
18 |
-
|
19 |
# substitute ' ·\n' by ...
|
20 |
str_ext = re.sub(r" ·", r"...", str_ext)
|
21 |
|
@@ -54,6 +54,7 @@ def punctuate_p(str_ext):
|
|
54 |
|
55 |
|
56 |
def to_cotovia(text):
|
|
|
57 |
## Initial text preprocessing
|
58 |
# substitute ' M€' by 'millóns de euros' and 'somewordM€' by 'someword millóns de euros'
|
59 |
text = re.sub(r"(\w+)\s*M€", r"\1 millóns de euros", text)
|
@@ -102,6 +103,7 @@ def to_cotovia(text):
|
|
102 |
return segs
|
103 |
|
104 |
def text_preprocess(text):
|
|
|
105 |
|
106 |
cotovia_preproc_text = to_cotovia(text)
|
107 |
|
@@ -117,6 +119,7 @@ def text_preprocess(text):
|
|
117 |
|
118 |
|
119 |
def main():
|
|
|
120 |
parser = argparse.ArgumentParser(description='Cotovía text normalisation')
|
121 |
parser.add_argument('text', type=str, help='Text to synthetize')
|
122 |
parser.add_argument('model_path', type=str, help='Absolute path to the model checkpoint.pth')
|
|
|
15 |
|
16 |
# function to add original punctuation to cotovía numbers extension (option p)
|
17 |
def punctuate_p(str_ext):
|
18 |
+
"""fix punctuation in cotovia output"""
|
19 |
# substitute ' ·\n' by ...
|
20 |
str_ext = re.sub(r" ·", r"...", str_ext)
|
21 |
|
|
|
54 |
|
55 |
|
56 |
def to_cotovia(text):
|
57 |
+
"""Preprocess text with Cotovía"""
|
58 |
## Initial text preprocessing
|
59 |
# substitute ' M€' by 'millóns de euros' and 'somewordM€' by 'someword millóns de euros'
|
60 |
text = re.sub(r"(\w+)\s*M€", r"\1 millóns de euros", text)
|
|
|
103 |
return segs
|
104 |
|
105 |
def text_preprocess(text):
|
106 |
+
"""make call to cotovia and return the preprocessed text"""
|
107 |
|
108 |
cotovia_preproc_text = to_cotovia(text)
|
109 |
|
|
|
119 |
|
120 |
|
121 |
def main():
|
122 |
+
"""Main function to synthesize text"""
|
123 |
parser = argparse.ArgumentParser(description='Cotovía text normalisation')
|
124 |
parser.add_argument('text', type=str, help='Text to synthetize')
|
125 |
parser.add_argument('model_path', type=str, help='Absolute path to the model checkpoint.pth')
|