Module:siwa-noun: Difference between revisions
No edit summary |
No edit summary |
||
| Line 49: | Line 49: | ||
end | end | ||
local function detect_decl(word, stressed) | local function detect_decl(word, stressed, gender) | ||
word = dedigraphicize(word) | word = dedigraphicize(word) | ||
if match(sub(word, -1, -1), "[ảẻỉỏủỷởử]") or word:match(vowels .. vowels .. "$") or word:match("ir$") then | if gender == "a" then return "animate" | ||
elseif match(sub(word, -1, -1), "[ảẻỉỏủỷởử]") or word:match(vowels .. vowels .. "$") or word:match("ir$") then | |||
return "l" | return "l" | ||
elseif match(vowels, sub(word, -1, -1)) then | elseif match(vowels, sub(word, -1, -1)) then | ||
| Line 70: | Line 71: | ||
local args = {} | local args = {} | ||
local sv = NAMESPACE == "Template" and "i" or parent_args[2] | local sv = NAMESPACE == "Template" and "i" or parent_args[2] | ||
local decl_type = parent_args["decl"] or detect_decl(word, sv) | local decl_type = parent_args["decl"] or detect_decl(word, sv, g) | ||
if g ~= "i" and g ~= "a" then error("Unknown gender: it must be either ‘i’ or ‘a’") end | if g ~= "i" and g ~= "a" then error("Unknown gender: it must be either ‘i’ or ‘a’") end | ||
| Line 159: | Line 160: | ||
end | end | ||
function | function make_cases(data) | ||
local cases = {"inessive", "illative", "elative", "adessive", "allative", "ablative"} | local cases = {"inessive", "illative", "elative", "adessive", "allative", "ablative"} | ||
local all = {"u", "m"} | local all = {"u", "m"} | ||
| Line 176: | Line 177: | ||
end | end | ||
else | else | ||
for n, number in ipairs(numbers) do | |||
table.insert(ret, "! " .. number .. "\n") | |||
for _, single in ipairs(all) do | |||
table.insert(ret, "| " .. link(show_form(data.forms[single .. number_short[n]])) .. "\n") | table.insert(ret, "| " .. link(show_form(data.forms[single .. number_short[n]])) .. "\n") | ||
end | end | ||
end | end | ||
end | end | ||
| Line 202: | Line 201: | ||
! rowspan=2 | Unmarked<br>''agentive/dative'' !! rowspan=2 | Marked<br>''patientive/genitive'' !! colspan="6" | Locative | ! rowspan=2 | Unmarked<br>''agentive/dative'' !! rowspan=2 | Marked<br>''patientive/genitive'' !! colspan="6" | Locative | ||
|- | |- | ||
]=] . | ]=] .. make_cases(data) .. [=[ | ||
|}</div></div>]=] | |}</div></div>]=] | ||
| Line 210: | Line 209: | ||
! Unmarked<br>''agentive/dative'' !! Marked<br>''patientive/genitive'' | ! Unmarked<br>''agentive/dative'' !! Marked<br>''patientive/genitive'' | ||
|- | |- | ||
]=] . | ]=] .. make_cases(data) .. [=[ | ||
|}</div></div>]=] | |}</div></div>]=] | ||