Module:smj-common
Appearance
- The following documentation is located at Module:smj-common/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local export = {}
local langdata = {
consonant = {
"^(.-)([^aáeiouyåäAÁEIOUYÅÄ" .. mw.ustring.char(0x0304) .. "{}-]*)$",
},
vowel = {
"^(.-)(uo)$",
"^(.-)(oa)$",
"^(.-)(å̄)$",
"^(.-)(ie)$",
"^(.-)([aáeiouyåäAÁEIOUYÅÄ]?)$",
},
scons = {
[1] = {
},
[2] = {
{"^bm$", "m", "bbm"},
{"^dn(j?)$", "n%1", "ddn%1"},
{"^gŋ$", "ŋ", "ggŋ"},
{"^dj$", "j", "ddj"},
{"^([flmnŋrsv])%1$", "%1", "%1ˈ%1"},
{"^hp$", "b", "hpp"},
{"^ht$", "d", "htt"},
{"^ht([js])$", "t%1", "htt%1"},
{"^hk$", "g", "hkk"},
{"^([ns])%1j$", "%1j", "%1ˈ%1j"},
},
[3] = {
{"^bb$", "pp"},
{"^dd$", "tt"},
{"^gg$", "kk"},
{"^dt([js])$", "tt%1"},
-- Clusters beginning with k
{"^k([st])$", "v%1"},
{"^k(t[js])$", "v%1"},
-- Clusters, xxy > xy
{"^(l)%1([djnt])$", "%1%2"},
{"^(l)%1(t[js])$", "%1%2"},
{"^(m)%1([bp])$", "%1%2"},
{"^(n)%1([dt])$", "%1%2"},
{"^(n)%1(t[js])$", "%1%2"},
{"^(ŋ)%1([gk])$", "%1%2"},
{"^(p)%1([st])$", "%1%2"},
{"^(p)%1(sj)$", "%1%2"},
{"^(p)%1(t[js])$", "%1%2"},
{"^(s)%1(j?)([kmntv])$", "%1%2%3"},
-- Clusters, xyy > xy
{"^(b)([dl])%2$", "%1%2"},
{"^(j)([bdgkmnrtv])%2$", "%1%2"},
{"^(l)([bgkmŋpv])%2$", "%1%2"},
{"^(r)([bdfgjkmnŋstv])%2$", "%1%2"},
{"^(v)([dgklnr])%2$", "%1%2"},
{"^([^dhk])t(t[js])$", "%1%2"},
{"^([^dn])n(nj)$", "%1%2"},
{"^(.)hnn$", "%1hn"},
--{"^j(.)%2$", "%1%2"},
--{"^([^h])nnj$", "%1nj"},
--{"^(.)ssj$", "%1sj"},
--{"^([^dhk])tt([js])$", "%1t%2"},
{"^ksj$"},
},
},
to_final = {
-- Allowed consonants
{"^[jklmnrstv]$"},
{"^sj$"},
-- Disallowed consonants
{"^d$", "t"},
{"^g$", "k"},
{"^h$", "j"},
{"^ss$", "s"},
{"^tj$", "sj"},
{"^ttj$", "sj"},
-- Clusters
{"^([jl])d$", "%1t"},
{"^lg$", "lk"},
{"^st$", "s"},
},
make_final_if = {
"^$",
},
vowel_variants = {
normal = { },
e = { ["e"] = {"á", "L"}, ["o"] = {"u"}},
i = { ["e"] = {"i"} , },
j = { ["e"] = {"i"} , },
je = { ["e"] = {"i"} , ["o"] = {"u"}},
j_contr = {["a"] = {"i"}, ["å"] = {"i"}, ["e"] = {"i"} , ["o"] = {"u"}},
j_contr_final = {["a"] = {"e"}, ["å"] = {"e"}, },
pres_12sg = { ["e"] = {"á", "L"}, },
pres_3sg = {["a"] = {"á"}, ["å"] = {"å̄"}, ["e"] = {"á", "L"}, ["o"] = {"u"}},
impr = {["a"] = {"o"}, ["å"] = {"o"}, ["e"] = {"o", "L"}, },
opta = {["a"] = {"u"}, ["å"] = {"u"}, ["e"] = {"u", "L"}, ["o"] = {"u"}},
},
postprocess = function(form, vowel_effect)
if vowel_effect == "L" and form.svowel == "ie" then
form.svowel = "ä"
end
-- Monophtongisation before Q1/Q2 + short vowel
if form.quantity < 3 and mw.ustring.find(form.uvowel, "^[aiuå]$") then
if form.svowel == "oa" then
form.svowel = "å̄"
elseif form.svowel == "ä" then
form.svowel = "e"
end
else
if form.svowel == "e" then
form.svowel = "ä"
elseif form.svowel == "å̄" then
form.svowel = "oa"
end
end
-- Convert a, á to å, å̄ after short å
if form.svowel == "å" then
if form.uvowel == "a" then
form.uvowel = "å"
elseif form.uvowel == "á" then
form.uvowel = "å̄"
end
end
-- Lengthen final a or å after short vowel + Q1 consonant
if form.quantity == 1 and mw.ustring.find(form.svowel, "^[aiuå]$") then
if form.uvowel == "a" then
form.uvowel = "á"
elseif form.uvowel == "å" then
form.uvowel = "å̄"
end
end
end,
}
export.Stem = require("Module:smi-common").make_constructor(langdata)
return export