Module:siwa-noun: Difference between revisions
No edit summary |
No edit summary |
||
| Line 14: | Line 14: | ||
local UNRELEASED = u(0x031A) -- COMBINING LEFT ANGLE ABOVE. ̚ | local UNRELEASED = u(0x031A) -- COMBINING LEFT ANGLE ABOVE. ̚ | ||
local | local vowels = "[iɪyeøɛœæauɔ̃ɑʊ]" | ||
local pagename = mw.title.getCurrentTitle().title | |||
local stressedvowels = { | local stressedvowels = { | ||
| Line 38: | Line 30: | ||
["di"] = "", ["nįi"] = "gįi", ["hhį"] = "ṡ", ["[ou]ų"] = "ů", | ["di"] = "", ["nįi"] = "gįi", ["hhį"] = "ṡ", ["[ou]ų"] = "ů", | ||
} | } | ||
function syll_count(term) | |||
term = m_pron.crux(term, true, false, false) | |||
local xc = "[mnɲŋpbtdcɟkɡvðsɕzʑxɣhrlɬjw⁽ʰ⁾ʔː̥͡"..UNRELEASED.."]" | |||
local pattern = "(" .. xc .. "?" .. vowels .. "+ː?" .. xc .. "*)" | |||
return gsub(term, pattern, "%1") | |||
end | |||
local function detect_quality(word) | |||
local stressed, n = syll_count(word) | |||
if find(stressed, vowels .. vowels .. vowels .. "?") or find(stressed, vowels .. "ː") or n>=3 then | |||
return "w" -- weak nouns | |||
else return "s" -- strong nouns | |||
end -- long nouns are unpredictable, they will have to be inputted manually | |||
end | |||
local function detect_decl(word, sv, quality) | local function detect_decl(word, sv, quality) | ||
| Line 54: | Line 62: | ||
local args = require("Module:parameters").process(frame:getParent().args, params) | local args = require("Module:parameters").process(frame:getParent().args, params) | ||
local | local sv = nil | ||
local decl_type = {} | local decl_type = {} | ||
local word = | local word = args[2] ~= nil and args[2] or pagename | ||
local prefix = sub(pagename, 1, -(#word+1)) | |||