blob: e381cd45762ac4e9710cd5369890406633f6918c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import re
def detectYears(input):
YEAR_REGEX = re.compile(r'(\b)(\d\d)([1-9]\d)(\b)')
return YEAR_REGEX.sub('\g<1>\g<2> \g<3>\g<4>', input)
def clean(input):
"""
Manually adjust output text before it's translated into
actual speech by the TTS system. This is to fix minior
idiomatic issues, for example, that 1901 is pronounced
"one thousand, ninehundred and one" rather than
"nineteen ninety one".
Arguments:
input -- original speech text to-be modified
"""
return detectYears(input)
|