Module:qlu-pron: Difference between revisions
Created page with "local sub = mw.ustring.sub local find = mw.ustring.find local gmatch = mw.ustring.gmatch local gsub = mw.ustring.gsub local match = mw.ustring.match local u = mw.ustring.char local split = mw.text.split local gsplit = mw.text.gsplit local lang = require("Module:languages").getByCode("qlu") local m_table = require("Module:table") local m_IPA = require("Module:IPA") local export = {} local consonants = "[mnɲŋptkbdɡɸfsθʃxβvzðɣʦʧʣʤlʎrɹɾʁʒʈ]" local front..." |
No edit summary |
||
| Line 14: | Line 14: | ||
local export = {} | local export = {} | ||
local consonants = "[ | local consonants = "[mnɲŋptkbdɡɸfsθʃxβvzðɣʦʧʣʤlʎrɹɾʁʒʈʷʨʥḱːjw]" | ||
local front = " | local front = "ieɛɪæyʏøœ" | ||
local back = " | local back = "uoɔʊʌɑɒ" | ||
local vowels = "[aɐ" .. front .. back .. " | local vowels = "[aɐ" .. front .. back .. "ːjw]" | ||
local function laxen(v) | local function laxen(v) | ||
| Line 37: | Line 37: | ||
local first_rules = { | local first_rules = { | ||
{"sc([ei])", "ʃ%1"}, {"c([ei])", "ʧ%1"}, {"g([ei])", "ʤ%1"}, {"%-", ""}, | {"sc([ei])", "ʃ%1"}, {"c([ei])", "ʧ%1"}, {"g([ei])", "ʤ%1"}, {"gu", "ǵ"}, {"%-", ""}, | ||
{"ch", "k"}, {"gh", " | {"ch?", "k"}, {"g([cqg])", "ŋ%1"}, {"gli", "ʎi"}, {"gni", "ɲi"}, | ||
{"gh?", "ɡ"}, {"ph", "ɸ"}, {"th", "ʈ"}, {"h", ""}, | |||
{"qu?", "ḱ"}, {"z", "ʦ"}, {"þ", "θ"}, | |||
{" | {"ae", "ɛ"}, {"au", "ɔ"}, {"ei", "i"}, | ||
} | } | ||
local phonetic_rules = { | local phonetic_rules = { | ||
} | |||
local last_rules = { | |||
-- Escaped characters | |||
-- | {"ʤ", "d͡ʒ"}, {"ʧ", "t͡ʃ"}, {"ʦ", "t͡s"}, {"ʣ", "d͡z"}, | ||
{" | {"ḱ", "kʷ"}, {"ǵ", "ɡʷ"}, {"ʈ", "t"}, | ||
{" | |||
} | } | ||
local function syllabify(word) | local function syllabify(word) | ||
word = gsub(word, "(" .. consonants .. "?" .. consonants .. "?" .. consonants .. "?" .. vowels .. "?" .. vowels .. vowels .. "?" .. consonants .. "?" .. consonants .. "?)", "·%1·") | |||
word = gsub(word, "(" .. consonants .. " | |||
local syllables = split(word, "·"); | local syllables = split(word, "·"); | ||
| Line 80: | Line 62: | ||
if #syllables ~= 1 then | if #syllables ~= 1 then | ||
for i, syll in ipairs(syllables) do | for i, syll in ipairs(syllables) do | ||
table.insert(syllables, #syllables-1, "ˈ") | |||
return ret | |||
end | end | ||
| Line 116: | Line 86: | ||
end | end | ||
--term = | term = syllabify(term) | ||
--[[for _, rule in ipairs(phonetic_rules) do | |||
term = gsub(term, rule[1], rule[2]) | |||
end]] | |||
term = gsub(term, "·", ".") | |||
term = gsub(term, "%.%.", ".") | |||
for _, rule in ipairs( | for _, rule in ipairs(last_rules) do | ||
term = gsub(term, rule[1], rule[2]) | term = gsub(term, rule[1], rule[2]) | ||
end | end | ||
return term | return term | ||