Module:qhv-noun: Difference between revisions
Jump to navigation
Jump to search
This module generates automatic High Valyrian noun inflection tables through
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
local gsub = mw.ustring.gsub | local gsub = mw.ustring.gsub | ||
local find = mw.ustring.find | local find = mw.ustring.find | ||
local m_utils = require("Module:utilities") | |||
local export = {} | local export = {} | ||
Line 7: | Line 9: | ||
local endings = { | local endings = { | ||
["a"] = "1-l", ["ar"] = "1-a", ["y"] = "2-l", ["ys"] = "2-s", ["o"] = "3-l", ["os"] = "3-s", ["ȳs"] = "3-s-v", ["ks"] = "3-s-k", | ["a"] = "1-l", ["ar"] = "1-a", ["y"] = "2-l", ["ys"] = "2-s", ["o"] = "3-l", ["os"] = "3-s", ["ȳs"] = "3-s-v", ["ks"] = "3-s-k", | ||
["on"] = "3-t", ["or"] = "3-a", ["e"] = "4-l", ["es"] = "4-s", [" | ["on"] = "3-t", ["or"] = "3-a", ["e"] = "4-l", ["es"] = "4-s", ["ien"] = "4-t", ["i"] = "5-l", ["is"] = "5-s", ["ir"] = "5-a", | ||
} | } | ||
local endings_reverse = { | local endings_reverse = { | ||
["1-l"] = "a", ["1-a"] = "ar", ["2-l"] = "y", ["2-s"] = "ys", ["3-l"] = "o", ["3-s"] = "os", ["3-s-v"] = "ȳs", ["3-s-k"] = "ks", | ["1-l"] = "a", ["1-a"] = "ar", ["2-l"] = "y", ["2-s"] = "ys", ["3-l"] = "o", ["3-s"] = "os", ["3-s-v"] = "ȳs", ["3-s-k"] = "ks", | ||
["3 | ["3-t"] = "on", ["3-a"] = "or", ["4-l"] = "e", ["4-s"] = "es", ["4-t"] = "ien", ["5-l"] = "i", ["5-s"] = "is", ["5-a"] = "ir", | ||
} | } | ||
Revision as of 22:16, 9 February 2021
- The following documentation is located at Module:qhv-noun/doc.[edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module generates automatic High Valyrian noun inflection tables through
{{qhv-decl-noun}}
. Do not use directly.
local sub = mw.ustring.sub
local gsub = mw.ustring.gsub
local find = mw.ustring.find
local m_utils = require("Module:utilities")
local export = {}
local endings = {
["a"] = "1-l", ["ar"] = "1-a", ["y"] = "2-l", ["ys"] = "2-s", ["o"] = "3-l", ["os"] = "3-s", ["ȳs"] = "3-s-v", ["ks"] = "3-s-k",
["on"] = "3-t", ["or"] = "3-a", ["e"] = "4-l", ["es"] = "4-s", ["ien"] = "4-t", ["i"] = "5-l", ["is"] = "5-s", ["ir"] = "5-a",
}
local endings_reverse = {
["1-l"] = "a", ["1-a"] = "ar", ["2-l"] = "y", ["2-s"] = "ys", ["3-l"] = "o", ["3-s"] = "os", ["3-s-v"] = "ȳs", ["3-s-k"] = "ks",
["3-t"] = "on", ["3-a"] = "or", ["4-l"] = "e", ["4-s"] = "es", ["4-t"] = "ien", ["5-l"] = "i", ["5-s"] = "is", ["5-a"] = "ir",
}
local function detect_decl(word, decl, class)
if decl and class then
local declension = decl .. "-" .. class
return declension, {sub(word, 1, -(#endings_reverse[declension] + 1))}
elseif decl == "6" then -- sixth declension
if class then
return "6-" .. class, {sub(word, 1, -2)}
else
error("Noun class must be specified for sixth-declension nouns.")
end
end
end
return export