Skip to content

Commit edb3187

Browse files
committed
Some fixes in english_ibm_fixes should've actually applied globally. Moved the punctuation fixes formerly part of english_ibm_fixes to a new global_ibm_fixes section to improve the experience for non-English languages
1 parent 450c815 commit edb3187

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

addon/synthDrivers/ibmeci.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@
6060
re.compile(br"\b(\d+|\W+)?(\w+\_+)?(\_+)?([bcdfghjklmnpqrstvwxz]+)?(\d+)?t+z[s]che", re.I): br"\1 \2 \3 \4 \5 tz sche",
6161
re.compile(br"(juar)([a-z']{9,})", re.I): br"\1 \2"
6262
}
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+
}
6371
english_ibm_fixes = {
6472
#Mostly duplicates english_fixes, but removes unneded replacements.
6573
#This won't crash, but ViaVoice doesn't like spaces in Mc names.
@@ -76,12 +84,6 @@
7684
re.compile(br"(re|un|non|anti)cosp", re.I): br"\1kosp",
7785
re.compile(br"\b(\d+|\W+)?(\w+\_+)?(\_+)?([bcdfghjklmnpqrstvwxz]+)?(\d+)?t+z[s]che", re.I): br"\1 \2 \3 \4 \5 tz sche",
7886
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",
8587
#ViaVoice-Specific crash words
8688
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",
8789
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):
336338
# language crash fixes.
337339
curLang = _ibmeci.params[_ibmeci.ECIParam.eciLanguageDialect]
338340
if _ibmeci.isIBM:
341+
text = resub(ibm_global_fixes, text)
339342
if curLang in (EciLangs.GeneralAmericanEnglish, EciLangs.BritishEnglish, EciLangs.MandarinChinese, EciLangs.StandardKorean, EciLangs.HongKongCantonese):
340343
text = resub(english_ibm_fixes, text)
341344
elif curLang in ('esp', EciLangs.CastilianSpanish):

0 commit comments

Comments
 (0)