Module:accel/fi
Appearance
- පහත දැක්වෙන උපදෙස්, Module:documentation මගින් ජනනය කොට ඇත. [සංස්කරණය කරන්න]
- ප්රයෝජනවත් සබැඳි: root page • root page’s subpages • සබැඳි • transclusions • testcases • sandbox
This module contains new entry creation rules for ෆින්ලන්ත; see WT:ACCEL for an overview, and Module:accel for information on creating new rules.
return {generate = function (params, entry)
local headparam = {}
local formparam = {
['plural-nominative'] = 'case=nominative|pl=plural',
['singular-genitive'] = 'case=genitive|pl=singular',
['plural-genitive'] = 'case=genitive|pl=plural',
['singular-partitive'] = 'case=partitive|pl=singular',
['plural-partitive'] = 'case=partitive|pl=plural',
['singular-accusative'] = 'case=accusative|pl=singular',
['plural-accusative'] = 'case=accusative|pl=plural',
['singular-inessive'] = 'case=inessive|pl=singular',
['plural-inessive'] = 'case=inessive|pl=plural',
['singular-elative'] = 'case=elative|pl=singular',
['plural-elative'] = 'case=elative|pl=plural',
['singular-illative'] = 'case=illative|pl=singular',
['plural-illative'] = 'case=illative|pl=plural',
['singular-adessive'] = 'case=adessive|pl=singular',
['plural-adessive'] = 'case=adessive|pl=plural',
['singular-ablative'] = 'case=ablative|pl=singular',
['plural-ablative'] = 'case=ablative|pl=plural',
['singular-allative'] = 'case=allative|pl=singular',
['plural-allative'] = 'case=allative|pl=plural',
['singular-essive'] = 'case=essive|pl=singular',
['plural-essive'] = 'case=essive|pl=plural',
['singular-translative'] = 'case=translative|pl=singular',
['plural-translative'] = 'case=translative|pl=plural',
['plural-instructive'] = 'case=instructive|pl=plural',
['plural-comitative'] = 'case=comitative|pl=plural', -- needs alt forms
['singular-abessive'] = 'case=abessive|pl=singular',
['plural-abessive'] = 'case=abessive|pl=plural'}
local participle_heads = {
['pres|actv|part'] = 'present active participle',
['pres|pasv|part'] = 'present passive participle',
['past|actv|part'] = 'past active participle',
['past|pasv|part'] = 'past passive participle',
['agentpart'] = 'agent participle',
['neg|part'] = 'negative participle',
}
local function scan_vowel_harmony(word)
for pos = #word, 1, -1 do
local char = mw.ustring.sub(word, pos, pos)
if mw.ustring.match(char, "[aou]") then
return "a"
elseif mw.ustring.match(char, "[äöy]") then
return "ä"
end
end
return "ä"
end
local function generate_participle_declension(word, type)
local vhua = { ["u"] = "a", ["y"] = "ä" }
local lword = mw.ustring.len(word)
if type == "pres|actv|part" then -- ...vA
return "{{fi-decl-koira|pos=adj|" .. mw.ustring.sub(word, 1, lword - 1) .. "|||" .. mw.ustring.sub(word, lword, lword) .. "}}"
elseif type == "pres|pasv|part" then -- ...(t)tAvA
return "{{fi-decl-koira|pos=adj|" .. mw.ustring.sub(word, 1, lword - 1) .. "|||" .. mw.ustring.sub(word, lword, lword) .. "}}"
elseif type == "past|actv|part" then -- ...(n)Ut
return "{{fi-decl-kuollut|pos=adj|" .. mw.ustring.sub(word, 1, lword - 2) .. "|" .. vhua[mw.ustring.sub(word, lword - 1, lword - 1)] .. "}}"
elseif type == "past|pasv|part" then -- ...tU
-- this is the most complicated one
local special = mw.ustring.sub(word, lword - 2, lword - 2)
local final = mw.ustring.sub(word, lword, lword) -- U
final = final .. "|" .. vhua[final] -- U|A
if special == "l" or special == "n" or special == "r" then
return "{{fi-decl-valo|pos=adj|" .. mw.ustring.sub(word, 1, lword - 3) .. "|" .. special .. "t|" .. special .. special .. "|" .. final .. "}}"
elseif special == "t" then
return "{{fi-decl-valo|pos=adj|" .. mw.ustring.sub(word, 1, lword - 3) .. "|tt|t|" .. final .. "}}"
elseif special == "s" then
return "{{fi-decl-valo|pos=adj|" .. mw.ustring.sub(word, 1, lword - 1) .. "|||" .. final .. "}}"
else
return "{{fi-decl-valo|pos=adj|" .. mw.ustring.sub(word, 1, lword - 2) .. "|t|d|" .. final .. "}}"
end
elseif type == "agentpart" then -- ...mA
return "{{fi-decl-koira|pos=adj|" .. mw.ustring.sub(word, 1, lword - 1) .. "|||" .. mw.ustring.sub(word, lword, lword) .. "|hideadjnote=1}}"
elseif type == "neg|part" then -- ...mAtOn
return "{{fi-decl-onneton|pos=adj|" .. mw.ustring.sub(word, 1, lword - 3) .. "|" .. mw.ustring.sub(word, lword - 3, lword - 3) .. "}}"
else
return nil -- ????
end
end
local was_rare = false
if params.form:sub(1, 5) == "rare-" then
was_rare = true
params.form = params.form:sub(6)
end
if params.form:sub(1, 11) == "comparative" then
local form, vh = unpack(mw.text.split(params.form, '|', true))
local vhfooter = scan_vowel_harmony(params.origin) .. "}} {{attention|fi|verify that vowel harmony is correct}}"
if vh == "a" or vh == "ä" then
vhfooter = vh .. "}}"
end
if params.pos == "adjective" then
if mw.ustring.sub(params.target, -3) == "mpi" then
entry.declension = "{{fi-decl-vanhempi|pos=adj|" ..
mw.ustring.sub(params.target, 1, -4) .. "|" .. vhfooter
elseif mw.ustring.sub(params.target, -4) == "inen" then
entry.declension = "{{fi-decl-nainen|pos=adj|" ..
mw.ustring.sub(params.target, 1, -4) .. "|" .. vhfooter
else
entry.declension = "{{rfinfl|fi}}"
end
end
elseif params.form:sub(1, 11) == "superlative" then
local form, vh = unpack(mw.text.split(params.form, '|', true))
local vhfooter = scan_vowel_harmony(params.origin) .. "}} {{attention|fi|verify that vowel harmony is correct}}"
if vh == "a" or vh == "ä" then
vhfooter = vh .. "}}"
end
if params.pos == "adjective" then
entry.declension = "{{fi-decl-sisin|pos=adj|" ..
mw.ustring.sub(params.target, 1, -3) .. "|" .. vhfooter
end
elseif params.form:sub(1, 15) == "part-possessive" then
-- possessive form of adverbial
local form, poss = unpack(mw.text.split(params.form, '|', true))
-- replace 3s,3p => 3, because 3rd person singular and plural are identical and "third-person" is thus enough
entry.def = entry.make_def("inflection of", "||" .. poss:gsub("(%d)(%a)", "%1|%2|form"):gsub("3", "3|form"))
elseif params.form:sub(1, 10) == "possessive" then
-- possessive form of nominal
if params.pos == "noun" then
entry.head = entry.make_head("noun possessive form")
end
local form, poss, decltype, inflection = unpack(mw.text.split(params.form, '|', true))
inflection = require('Module:base64').decode(inflection)
entry.def = entry.make_def("inflection of", "||" .. poss:gsub("(%d)(%a)", "%1|%2|poss"):gsub("3%|%a", "3"))
-- copy declension for possessive from original entry
if decltype == "askel" and mw.ustring.match(params.target, "ee.?.?.?$") then
decltype = decltype .. "|e=1" -- try to detect e=1
end
entry.declension = "{{fi-decl-" .. decltype .. "|poss=" .. poss .. "|" .. inflection .. "}}"
elseif params.form:sub(1, 11) == "participle-" then
-- participles; require declension
local infl = mw.ustring.sub(params.form, #"participle-" + 1)
local declension = generate_participle_declension(params.target, infl)
if declension == nil then error("Unsupported participle " .. infl) end
entry.def = entry.make_def("inflection of", "||" .. infl)
entry.head = entry.make_head(participle_heads[infl] or "participle")
entry.pos_header = "Participle"
entry.declension = declension
elseif mw.ustring.match(params.form, "^inf1l-") then
-- long first infinitive; requires alt forms for other persons
local vh = mw.ustring.match(params.form, "([aä])$")
if vh ~= "a" and vh ~= "ä" then error("Invalid vowel harmony") end
if not params.target:match("en$") then
error("Unsupported long first infinitive form")
end
entry.head = entry.make_head("infinitive")
entry.def = entry.make_def("inflection of", "||3|form|of the|long|first|inf")
entry.altforms = '{{fi-word-poss|header=person|' .. mw.ustring.sub(params.target, 1, mw.ustring.len(params.target) - 2) .. '|' .. vh .. '}}'
elseif mw.ustring.match(params.form, "^inf5-") then
-- fifth infinitive; requires alt forms for other persons
local vh = mw.ustring.match(params.form, "([aä])$")
if vh ~= "a" and vh ~= "ä" then error("Invalid vowel harmony") end
if not params.target:match("[aä]n$") then
error("Unsupported fifth infinitive form")
end
entry.head = entry.make_head("infinitive")
entry.def = entry.make_def("inflection of", "||3|form|of the|fifth|inf")
entry.altforms = '{{fi-word-poss|header=person|' .. mw.ustring.sub(params.target, 1, mw.ustring.len(params.target) - 2) .. '|' .. vh .. '}}'
elseif mw.ustring.match(params.form, "|inf") then
entry.head = entry.make_head("infinitive")
entry.def = entry.make_def("inflection of", "||" .. params.form)
elseif mw.ustring.match(params.form, "com%-pl%-[aä]") then
-- comitative (plural only); requires alt forms for other persons
local vh = mw.ustring.match(params.form, "com%-pl%-([aä])")
if vh ~= "a" and vh ~= "ä" then error("Invalid vowel harmony") end
entry.head = entry.make_head(headparam[params.form] or params.pos .. " form")
if params.target:match("en$") then
entry.altforms = '{{fi-alt-personal|' .. params.target:sub(1, (#params.target) - 2) .. '|e|' .. vh .. '}}'
entry.def = entry.make_def("inflection of", "||3|poss|form|of|com|p")
elseif params.target:match("ne$") then
entry.def = entry.make_def("inflection of", "||com|p")
else
error("Unsupported comitative form")
end
elseif formparam[params.form] then
entry.head = entry.make_head(headparam[params.form] or params.pos .. " form")
entry.def = '{{fi-form of|' .. params.origin .. '|' .. formparam[params.form] .. '}}'
else
-- needed here because of code below
entry.def = entry.make_def("inflection of", "||" .. params.form)
end
if was_rare then
entry.def = '{{lb|fi|nocat=1|rare}} ' .. entry.def
end
end}