diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-03-30 16:03:44 -0400 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-03-30 16:03:44 -0400 |
| commit | d31fabf8cff5dae02e3fc759a4203bd374dddc99 (patch) | |
| tree | 888ec4e6d98154f862a3b9cd17a3394b657bc02e /client/alteration.py | |
| parent | 4182b5e096e081158dddd4ad5d031af94fcc63de (diff) | |
| download | jasper-client-d31fabf8cff5dae02e3fc759a4203bd374dddc99.tar.gz jasper-client-d31fabf8cff5dae02e3fc759a4203bd374dddc99.zip | |
Initial commit
Diffstat (limited to 'client/alteration.py')
| -rw-r--r-- | client/alteration.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/client/alteration.py b/client/alteration.py new file mode 100644 index 0000000..e381cd4 --- /dev/null +++ b/client/alteration.py @@ -0,0 +1,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) |
