add docstring for normalizer

This commit is contained in:
lfchener 2020-12-18 19:36:12 +08:00
parent c2bc4b0474
commit 63285dc80f
2 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,8 @@ from parakeet.frontend.normalizer.numbers import normalize_numbers
def normalize(sentence):
""" Normalize English text.
"""
# preprocessing
sentence = unicode(sentence)
sentence = normalize_numbers(sentence)

View File

@ -75,6 +75,8 @@ def _expand_number(m):
def normalize_numbers(text):
""" Normalize numbers in English text.
"""
text = re.sub(_comma_number_re, _remove_commas, text)
text = re.sub(_pounds_re, r'\1 pounds', text)
text = re.sub(_dollars_re, _expand_dollars, text)