Module:mg-noun/data: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
local data = {}
local data = {}


data["O"] = {
data["o"] = {
params = {
params = {
[1] = {},
[1] = {},
},
},
}
}
setmetatable(data["O"], {__call = function(self, args, data)
setmetatable(data["o"], {__call = function(self, args, data)
local stem = data.head; local inserted = gsub(stem, "(.)o$", "i%1")
local stem = data.head; local inserted = gsub(stem, "(.)o$", "i%1")
local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
data.decl_type = "O"
data.decl_type = "o"
table.insert(data.categories, "Modern Gallaecian o-declension nouns")
table.insert(data.categories, "Modern Gallaecian o-declension nouns")
Line 28: Line 28:
})
})


data["A"] = {
data["a"] = {
params = {
params = {
[1] = {},
[1] = {},
},
},
}
}
setmetatable(data["A"], {__call = function(self, args, data)
setmetatable(data["a"], {__call = function(self, args, data)
local stem = data.head
local stem = data.head
local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
data.decl_type = "A"
data.decl_type = "a"
table.insert(data.categories, "Modern Gallaecian a-declension nouns")
table.insert(data.categories, "Modern Gallaecian a-declension nouns")
Line 50: Line 50:
})
})


data["E"] = {
data["e"] = {
params = {
params = {
[1] = {},
[1] = {},
},
},
}
}
setmetatable(data["E"], {__call = function(self, args, data)
setmetatable(data["e"], {__call = function(self, args, data)
local stem = data.head
local stem = data.head
local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
data.decl_type = "E"
data.decl_type = "e"
table.insert(data.categories, "Modern Gallaecian e-declension nouns")
table.insert(data.categories, "Modern Gallaecian e-declension nouns")
Line 72: Line 72:
})
})


data["N"] = {
data["n"] = {
params = {
params = {
[1] = {},
[1] = {},
},
},
}
}
setmetatable(data["N"], {__call = function(self, args, data)
setmetatable(data["n"], {__call = function(self, args, data)
local stem = data.head; data.decl_type = "N"
local stem = data.head; data.decl_type = "n"
local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
local changes = {["d"] = "n", ["z"] = "i", ["n"] = "n"}
local changes = {["d"] = "n", ["z"] = "i", ["n"] = "n"}
Line 97: Line 97:
})
})


data["R"] = {
data["r"] = {
params = {
params = {
[1] = {},
[1] = {},
},
},
}
}
setmetatable(data["R"], {__call = function(self, args, data)
setmetatable(data["r"], {__call = function(self, args, data)
local stem = data.head
local stem = data.head
local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
data.decl_type = "R"
data.decl_type = "r"
table.insert(data.categories, "Modern Gallaecian r-declension nouns")
table.insert(data.categories, "Modern Gallaecian r-declension nouns")

Revision as of 12:03, 12 September 2021



local sub = mw.ustring.sub
local gsub = mw.ustring.gsub
local match = mw.ustring.match
local PAGENAME = mw.title.getCurrentTitle().text

local data = {}

data["o"] = {
	params = {
		[1] = {},
	},
}
setmetatable(data["o"], {__call = function(self, args, data)
	local stem = data.head; local inserted = gsub(stem, "(.)o$", "i%1")
	local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
	data.decl_type = "o"
	table.insert(data.categories, "Modern Gallaecian o-declension nouns")
	
	data.forms["di_s"] = {s1 .. "o"}
	data.forms["da_s"] = {s1 .. "o"}
	data.forms["lo_s"] = {inserted .. "e"}
	
	data.forms["di_p"] = {s1 .. "os"}
	data.forms["da_p"] = {s1 .. "ú"}
	data.forms["lo_p"] = {s1 .. "ui"}
	
end
})

data["a"] = {
	params = {
		[1] = {},
	},
}
setmetatable(data["a"], {__call = function(self, args, data)
	local stem = data.head
	local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
	data.decl_type = "a"
	table.insert(data.categories, "Modern Gallaecian a-declension nouns")
	
	data.forms["di_s"] = {s1 .. "a"}
	data.forms["da_s"] = {s1 .. "e"}
	data.forms["lo_s"] = {s1 .. "e"}
	
	data.forms["di_p"] = {s1 .. "as"}
	data.forms["da_p"] = {s1 .. "au"}
	data.forms["lo_p"] = {s1 .. "ai"}
	
end
})

data["e"] = {
	params = {
		[1] = {},
	},
}
setmetatable(data["e"], {__call = function(self, args, data)
	local stem = data.head
	local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
	data.decl_type = "e"
	table.insert(data.categories, "Modern Gallaecian e-declension nouns")
	
	data.forms["di_s"] = {s1 .. "e"}
	data.forms["da_s"] = {s1 .. "e"}
	data.forms["lo_s"] = {s1 .. "e"}
	
	data.forms["di_p"] = {s1 .. "es"}
	data.forms["da_p"] = {s1 .. "iu"}
	data.forms["lo_p"] = {s1 .. "ei"}
	
end
})

data["n"] = {
	params = {
		[1] = {},
	},
}
setmetatable(data["n"], {__call = function(self, args, data)
	local stem = data.head; data.decl_type = "n"
	local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
	local changes = {["d"] = "n", ["z"] = "i", ["n"] = "n"}
	local changed = gsub(s1, ".$", function(foo) return changes[foo] or "-" end)
	table.insert(data.categories, "Modern Gallaecian n-declension nouns")
	
	data.forms["di_s"] = {stem}
	data.forms["di_p"] = {s2 .. "nes"}
	
	if not match(changed, "-") then
		data.forms["da_s"] = {s2 .. "ne"}
		data.forms["lo_s"] = {s2 .. "ne"}
		data.forms["da_p"] = {s2 .. "nú"}
		data.forms["lo_p"] = {s2 .. "nui"}
	end
	
end
})

data["r"] = {
	params = {
		[1] = {},
	},
}
setmetatable(data["r"], {__call = function(self, args, data)
	local stem = data.head
	local s1 = sub(stem, 1, -2); local s2 = sub(stem, 1, -3)
	data.decl_type = "r"
	table.insert(data.categories, "Modern Gallaecian r-declension nouns")
	
	data.forms["di_s"] = {s1 .. "r"}
	data.forms["da_s"] = {s2 .. "re"}
	data.forms["lo_s"] = {s2 .. "re"}
	
	data.forms["di_p"] = {s2 .. "res"}
	data.forms["da_p"] = {s2 .. "rú"}
	data.forms["lo_p"] = {s2 .. "rui"}
	
end
})

return data