Module:rad-IPA: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 1,890: Line 1,890:
         return nil
         return nil
end
end
mw.log(IPA)
local C_regex = "szlntdrmpbθðhjwçfvʃʒxŋkɡɲ%."
local V_long_regex = "[uyiɔœɛoɤeaæø][uyiɔœɛoɤeaæøː][ːeoi]?"
local V_short_regex = "[uyiɔœɛɤa]([^ːaeoiu])"
IPA = mw.ustring.match(IPA, "[^ˈˌ]+$")
IPA = mw.ustring.match(IPA, "[^ˈˌ]+$")
mw.log(IPA)
IPA = mw.ustring.gsub(IPA, "^[" .. C_regex .. "]+", "") -- delete consonant cluster
IPA = mw.ustring.gsub(IPA, "^[szlntdrmpbθðhjwçfvʃʒxŋkɡɲ%.]+", "") -- delete consonant cluster
IPA = mw.ustring.gsub(IPA, "^".. V_long_regex, "") -- delete long vowel
mw.log(IPA)
IPA = mw.ustring.gsub(IPA, "^" .. V_short_regex, "%1") -- delete short vowel
IPA = mw.ustring.gsub(IPA, "^[uyiɔœɛoɤeaæø][uyiɔœɛoɤeaæøː][ːeoi]?", "") -- delete long vowel
IPA = mw.ustring.gsub(IPA, "^[" .. C_regex .. "]+", "") -- delete consonant cluster
mw.log(IPA)
if mw.ustring.find(IPA, "^".. V_long_regex) then return nil end
IPA = mw.ustring.gsub(IPA, "^[uyiɔœɛɤa]([^ːaeoiu])", "%1") -- delete short vowel
mw.log(IPA)
IPA = mw.ustring.gsub(IPA, "^[szlntdrmpbθðhjwçfvʃʒxŋkɡɲ%.]+", "") -- delete consonant cluster
mw.log(IPA)
if mw.ustring.find(IPA, "^[uyiɔœɛoɤeaæø][uyiɔœɛoɤeaæøː][ːeoi]?") then return nil end


while true do
while true do
if mw.ustring.find(IPA, "^[uyiɔœɛoɤeaæø][uyiɔœɛoɤeaæøː][ːeoi]?") or mw.ustring.find(IPA, "^[uyiɔœɛɤa][szlntdrmpbθðhjwçfvʃʒxŋkɡɲ%.]*$") then
if mw.ustring.find(IPA, "^".. V_long_regex) or mw.ustring.find(IPA, "^[uyiɔœɛɤa][" .. C_regex .. "]*$") then
break
break
else
else
IPA = mw.ustring.gsub(IPA, "^[uyiɔœɛɤa]([^ːaeoiu])", "%1") -- delete short vowel
IPA = mw.ustring.gsub(IPA, "^" .. V_short_regex, "%1") -- delete short vowel
mw.log(IPA)
IPA = mw.ustring.gsub(IPA, "^[" .. C_regex .. "]+", "") -- delete consonant cluster
IPA = mw.ustring.gsub(IPA, "^[szlntdrmpbθðhjwçfvʃʒxŋkɡɲ%.]+", "") -- delete consonant cluster
mw.log(IPA)
end
end
end
end