|
60 | 60 | re.compile(br"\b(\d+|\W+)?(\w+\_+)?(\_+)?([bcdfghjklmnpqrstvwxz]+)?(\d+)?t+z[s]che", re.I): br"\1 \2 \3 \4 \5 tz sche",
|
61 | 61 | re.compile(br"(juar)([a-z']{9,})", re.I): br"\1 \2"
|
62 | 62 | }
|
| 63 | +ibm_global_fixes = { |
| 64 | +# Prevents the synth from spelling out everything if a punctuation mark follows a word. |
| 65 | + re.compile(br"([a-z]+)([~#$%^*({|\\[<%\x95])", re.I): br"\1 \2", |
| 66 | + #Don't break phrases like books). |
| 67 | + re.compile(br"([a-z]+)\s+(\(s\))", re.I): br"\1\2", |
| 68 | + #Removes spaces if a string is followed by a punctuation mark, since ViaVoice doesn't tolerate that. |
| 69 | + re.compile(br"([a-z]+|\d+|\W+)\s+([:.!;,?](?![a-z]|\d))", re.I): br"\1\2", |
| 70 | +} |
63 | 71 | english_ibm_fixes = {
|
64 | 72 | #Mostly duplicates english_fixes, but removes unneded replacements.
|
65 | 73 | #This won't crash, but ViaVoice doesn't like spaces in Mc names.
|
|
76 | 84 | re.compile(br"(re|un|non|anti)cosp", re.I): br"\1kosp",
|
77 | 85 | re.compile(br"\b(\d+|\W+)?(\w+\_+)?(\_+)?([bcdfghjklmnpqrstvwxz]+)?(\d+)?t+z[s]che", re.I): br"\1 \2 \3 \4 \5 tz sche",
|
78 | 86 | re.compile(br"(juar)([a-z']{9,})", re.I): br"\1 \2",
|
79 |
| -# Prevents the synth from spelling out everything if a punctuation mark follows a word. |
80 |
| - re.compile(br"([a-z]+)([~#$%^*({|\\[<%\x95])", re.I): br"\1 \2", |
81 |
| - #Don't break phrases like books). |
82 |
| - re.compile(br"([a-z]+)\s+(\(s\))", re.I): br"\1\2", |
83 |
| - #Removes spaces if a string is followed by a punctuation mark, since ViaVoice doesn't tolerate that. |
84 |
| - re.compile(br"([a-z]+|\d+|\W+)\s+([:.!;,?](?![a-z]|\d))", re.I): br"\1\2", |
85 | 87 | #ViaVoice-Specific crash words
|
86 | 88 | re.compile(br"(http://|ftp://)([a-z]+)(\W){1,3}([a-z]+)(/*\W){1,3}([a-z]){1}", re.I): br"\1\2\3\4 \5\6",
|
87 | 89 | re.compile(br"(\d+)([-+*^/])(\d+)(\.)(\d+)(\.)(0{2,})", re.I): br"\1\2\3\4\5\6 \7",
|
@@ -336,6 +338,7 @@ def processText(self,text):
|
336 | 338 | # language crash fixes.
|
337 | 339 | curLang = _ibmeci.params[_ibmeci.ECIParam.eciLanguageDialect]
|
338 | 340 | if _ibmeci.isIBM:
|
| 341 | + text = resub(ibm_global_fixes, text) |
339 | 342 | if curLang in (EciLangs.GeneralAmericanEnglish, EciLangs.BritishEnglish, EciLangs.MandarinChinese, EciLangs.StandardKorean, EciLangs.HongKongCantonese):
|
340 | 343 | text = resub(english_ibm_fixes, text)
|
341 | 344 | elif curLang in ('esp', EciLangs.CastilianSpanish):
|
|
0 commit comments