G2P: Added fallback rules to prevent illegal results
This commit is contained in:
parent
faea06933b
commit
fa0aff0012
|
@ -206,3 +206,10 @@
|
||||||
{ wregex(L"l(l)"), L"$1" },
|
{ wregex(L"l(l)"), L"$1" },
|
||||||
{ wregex(L"f(f)"), L"$1" },
|
{ wregex(L"f(f)"), L"$1" },
|
||||||
{ wregex(L"z(z)"), L"$1" },
|
{ wregex(L"z(z)"), L"$1" },
|
||||||
|
// There are a number of cases not covered by these rules.
|
||||||
|
// Let's add some reasonable fallback rules.
|
||||||
|
{ wregex(L"a"), L"â" },
|
||||||
|
{ wregex(L"e"), L"@" },
|
||||||
|
{ wregex(L"i"), L"ë" },
|
||||||
|
{ wregex(L"o"), L"ö" },
|
||||||
|
{ wregex(L"q"), L"k" },
|
||||||
|
|
|
@ -69,6 +69,17 @@ end
|
||||||
# Read rules
|
# Read rules
|
||||||
lines = File.read('../../lib/soundchange/english.sc', :encoding => 'iso-8859-1').split(/\r?\n/)
|
lines = File.read('../../lib/soundchange/english.sc', :encoding => 'iso-8859-1').split(/\r?\n/)
|
||||||
|
|
||||||
|
# Add supplementary rules
|
||||||
|
lines.push(
|
||||||
|
'* There are a number of cases not covered by these rules.',
|
||||||
|
'* Let\'s add some reasonable fallback rules.',
|
||||||
|
'a/â/_',
|
||||||
|
'e/@/_',
|
||||||
|
'i/ë/_',
|
||||||
|
'o/ö/_',
|
||||||
|
'q/k/_'
|
||||||
|
)
|
||||||
|
|
||||||
# Parse character class definitions
|
# Parse character class definitions
|
||||||
characterClassLineCount = 0
|
characterClassLineCount = 0
|
||||||
lines.each_with_index do |line, index|
|
lines.each_with_index do |line, index|
|
||||||
|
|
Loading…
Reference in New Issue