Module:siwa-noun: Difference between revisions
No edit summary |
No edit summary |
||
| Line 7: | Line 7: | ||
local sub = mw.ustring.sub | local sub = mw.ustring.sub | ||
local find = mw.ustring.find | local find = mw.ustring.find | ||
local | local match = mw.ustring.match | ||
local gsub = mw.ustring.gsub | local gsub = mw.ustring.gsub | ||
local u = mw.ustring.char | local u = mw.ustring.char | ||
| Line 35: | Line 35: | ||
term = gsub(term, "[ˌˈ]", "") | term = gsub(term, "[ˌˈ]", "") | ||
local xc = "[mnɲŋpbtdcɟkɡvðsɕzʑxɣhrlɬjw⁽ʰ⁾ʔː̥͡"..UNRELEASED.."]" | local xc = "[mnɲŋpbtdcɟkɡvðsɕzʑxɣhrlɬjw⁽ʰ⁾ʔː̥͡"..UNRELEASED.."]" | ||
local pattern = | local pattern = xc .. "?(" .. vowels .. "+ː?)(" .. xc .. "*)" | ||
term, n = gsub(term, pattern, "%1") | term, n = gsub(term, pattern, "%1") | ||
term = | term = match(term, pattern) | ||
return term, n | return term, n | ||
| Line 44: | Line 44: | ||
local function detect_quality(word) | local function detect_quality(word) | ||
local stressed, n = syll_count(word) | local stressed, n = syll_count(word) | ||
if | if match(stressed, vowels .. vowels .. vowels .. "?") or match(stressed, "ː") or n>=3 then | ||
return "w" -- weak nouns | return "w" -- weak nouns | ||
else return "s" -- strong nouns | else return "s" -- strong nouns | ||