Module:rad-stem/templates: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
mNo edit summary
No edit summary
Line 6: Line 6:
local m_links = require("Module:links")
local m_links = require("Module:links")
local m_languages = require("Module:languages")
local m_languages = require("Module:languages")
local C = "bcdðfghħjĵkķlmnņpqrsștvwxzþ°"


function get_stems(args)
function get_stems(args)
Line 20: Line 22:


function break_adj(adj)
function break_adj(adj)
local C = "bcdðfghħjĵkķlmnņpqrsștvwxzþ°"
local temp = adj
local temp = adj


Line 139: Line 140:
local function get_forms(case, base, adj_base, adj_ending, nolink)
local function get_forms(case, base, adj_base, adj_ending, nolink)
if adj_base then
if adj_base then
--adjust definite article --
local oblique_pl = {['genpl'] = true, ['datpl'] = true, ['accpl'] = true, ['inspl'] = true, ['gendu'] = true, ['datdu'] = true, ['accdu'] = true, ['insdu'] = true,}
-- detect inanimate --
if mw.ustring.match(mw.ustring.lower(adj_base), "(^ a [" .. C .. "])") or mw.ustring.match(adj_base, "(^ ag )") then
if oblique_pl[case] then
adj_base = mw.ustring.gsub(adj_base, "^ ag ([iíỉIÍỈ])", " a’ %1")
adj_base = mw.ustring.gsub(adj_base, "^ ag?", " ai")
elseif case == "genpl_short" or "gendu_short" then
adj_base = mw.ustring.gsub(adj_base, "^ ag?", " ais")
end
end
-- append --
base = base .. adj_base
base = base .. adj_base
if adj_ending then base = base .. adj_ending end
if adj_ending then base = base .. adj_ending end