48,355
edits
No edit summary |
No edit summary |
||
| Line 170: | Line 170: | ||
} | } | ||
local function syllabify(word) | local function syllabify(word, no_stress) | ||
local clusters = m_table.listToSet({ | local clusters = m_table.listToSet({ | ||
"s[ptʈkfɸ]", "z[bdgβʤmnlr]", | "s[ptʈkfɸ]", "z[bdgβʤmnlr]", | ||
| Line 207: | Line 207: | ||
local syllables = split(word, "·"); | local syllables = split(word, "·"); | ||
if #syllables == 1 then return dediacv(table.concat(syllables), "[" .. c.acute .. c.circ .. "]") end -- account for monosyllables | if no_stress then return dediacv(table.concat(syllables), "[" .. c.acute .. c.circ .. "]") end | ||
--if #syllables == 1 then return dediacv(table.concat(syllables), "[" .. c.acute .. c.circ .. "]") end -- account for monosyllables | |||
local first_stress = "[âêîôû]" | local first_stress = "[âêîôû]" | ||
| Line 236: | Line 237: | ||
end | end | ||
function export.crux(term, | function export.crux(term, no_stress) | ||
local ret, dialects = {}, {} | local ret, dialects = {}, {} | ||
term = mw.ustring.lower(term) | term = mw.ustring.lower(term) | ||
| Line 244: | Line 245: | ||
end | end | ||
term = syllabify(term) | term = syllabify(term, no_stress) | ||
term = term:gsub("·?([ˈˌ])·?", "%1") | term = term:gsub("·?([ˈˌ])·?", "%1") | ||
term = term:gsub("ˌˌ", "ˌ") | term = term:gsub("ˌˌ", "ˌ") | ||
| Line 283: | Line 284: | ||
end | end | ||
if outputs then | --[[if outputs then | ||
-- testcases | -- testcases | ||
if outputs == "phonemic" then | if outputs == "phonemic" then | ||
| Line 292: | Line 293: | ||
return "/" .. phonemic .. "/ [" .. phonetic .. "]" | return "/" .. phonemic .. "/ [" .. phonetic .. "]" | ||
end | end | ||
end | end]] | ||
dialects["paulistan"] = paulistan | dialects["paulistan"] = paulistan | ||
| Line 323: | Line 324: | ||
function separate_word(term) | function separate_word(term, no_stress) | ||
local phonemic, phonetic, dialects = {}, {}, {} | local phonemic, phonetic, dialects = {}, {}, {} | ||
local m, t, d = "", "", {} | local m, t, d = "", "", {} | ||
| Line 329: | Line 330: | ||
if match(term, " ") then | if match(term, " ") then | ||
for word in gsplit(term, " ") do | for word in gsplit(term, " ") do | ||
local ret, d = export.crux(word) | local ret, d = export.crux(word, no_stress) | ||
m = ret[1]; t = ret[2] | m = ret[1]; t = ret[2] | ||
| Line 351: | Line 352: | ||
local params = { | local params = { | ||
[1] = { default = mw.title.getCurrentTitle().nsText == 'Template' and "agghiu" or mw.title.getCurrentTitle().text }, | [1] = { default = mw.title.getCurrentTitle().nsText == 'Template' and "agghiu" or mw.title.getCurrentTitle().text }, | ||
["rs"] = {type = 'boolean'}, | |||
} | } | ||
local args = require("Module:parameters").process(parent_args, params) | local args = require("Module:parameters").process(parent_args, params) | ||
local term = args[1] | local term = args[1]; local no_stress = args.rs | ||
local ret, dialects = separate_word(term) | local ret, dialects = separate_word(term, no_stress) | ||
local phonemic = ret[1]; local phonetic = ret[2] | local phonemic = ret[1]; local phonetic = ret[2] | ||