|
|
Line 35: |
Line 35: |
| end | | end |
|
| |
|
| local function stressed(word) | | local function stressed(s1, s2) |
| local stpattern = "·?ˈ[mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥrlɬłʣjwʦ⁽ʰ⁾ʔː]*"..UNRELEASED.."?[iɪyeøɛœæauɔɑʊ]([mnɲŋpbtdcɟkɡʔvðsɕxɣhʨʥrlɬłʣjwʦʔː]*"..UNRELEASED.."?)" | | local stressed_rules = {["h"] = "ʔ", ["ɡį"] = "jː", ["hh"] = "hː",} |
| local ss = gsub(word, stpattern, "%1") | | local s2 = gsub(s2, s2, stressed_rules[s2]) |
| | | |
| local stressed_rules = {["h"] = "ʔ", ["ɡį"] = "jː", ["hh"] = "hː",}
| | return s1 .. s2 |
| local i,j = mw.ustring.find(word, ss)
| |
| local xx = gsub(ss, ss, stressed_rules[ss])
| |
| --[[for regex, replacement in pairs(stressed_rules) do
| |
| xx = gsub(ss, regex, replacement)
| |
| end]]
| |
| | |
| return sub(word,1,i-1) .. ss .. sub(word,j+1) | |
| end | | end |
|
| |
|
Line 94: |
Line 87: |
| }, | | }, |
| { | | { |
| ["(.*)"] = function(s1) return stressed(s1) end | | [stpattern] = stressed(s1, s2), |
| }, | | }, |
| } | | } |