Module:User:Mofvanes/otw-verb

Hello, you have come here looking for the meaning of the word Module:User:Mofvanes/otw-verb. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:Mofvanes/otw-verb, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:Mofvanes/otw-verb in singular and plural. Everything you need to know about the word Module:User:Mofvanes/otw-verb you have here. The definition of the word Module:User:Mofvanes/otw-verb will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:Mofvanes/otw-verb, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


local export = {}

local lang = require("Module:languages").getByCode("otw")
local m_string_utilities = require("Module:string utilities")
local m_links = require("Module:links")

local vowels = {"a", "i", "o", "e", "ā", "ī", "ō"}

local vai_pers = {"1s", "2s", "3s", "3’", "X", "1p", "21", "2p", "3p"}
local vai_accel = {
		 = {"1|s", "2|s", "3|s", "3|obv", "impers", "1|excl|p", "1|incl|p", "2|p", "3|p"},
		 = {"1|s", "2|s", "3|s", "3|obv", "impers", "1|excl|p", "1|incl|p", "2|p", "3|p"},
		 = {"1|s", "2|s", "3|s", "3|obv", "impers", "1|excl|p", "1|incl|p", "2|p", "3|p"},
		 = {"1|s", "2|s", "3|s", "3|obv", "impers", "1|excl|p", "1|incl|p", "2|p", "3|p"},
		 = {"1|s", "2|s", "3|s", "3|obv", "impers", "1|excl|p", "1|incl|p", "2|p", "3|p"}
}
local vai_pref = {
	 = {"ni", "gi", "",   "",    "", "ni",  "gi",  "gi", ""},
	 = {"nid", "gid", "",   "",    "", "nid",  "gid",  "gid", ""}
}
local vai_suff = {"", "", "W", "W", "m", "mi", "mi", "m", "W"}

local vai_neg = {
	 = "sii",
	 = "zii"
}
local vai_pret = {"nāban", "nāban", "iban", "iban", "aban", "āban", "āban", "iban"}
local vai_pret = {"nādig", "nādig", "idig", "idigen", "idig", "ādig", "ādig", "idigen"}
local vai_3suf = {
	 = {"", "", "", "an", "", "", "", "", "ag"}, 
	 = {"", "", "", "iin", "", "", "", "", "iig"}
} 

local vai_table = [=[
{| class="wikitable"
! scope=row | Pers.
! |Present 
|-
! scope=row | 1s
|  {1|s}
|-
! scope=row | 2s
|  {2|s}
|-
! scope=row | 3s
|  {3|s}
|-
! scope=row | 3’
|  {3|obv}
|-
! scope=row | X
|  {impers}
|-
! scope=row | 1p
|  {1|excl|p}
|-
! scope=row | 21
|  {1|incl|p}
|-
! scope=row | 2p
|  {2|p}
|-
! scope=row | 3p
|  {3|p}
|}
]=]

local vii_pers = {"0", "0’", "0p", "0’p"}
local vii_accel = {"3|s", "3|s|obv", "3|p", "3|p|obv"}

local vii_verb_table = [=[
{| class="wikitable"
!-
! scope=row | Pers.
! |Present 
|-
! scope=row | 0
|  {3|s}
|-
! scope=row | 0’
|  {3|s|obv}
|-
! scope=row | 0p
|  {3|p}
|-
! scope=row | 0’p
|  {3|p|obv}
|}
]=]

local rfind = mw.ustring.find
local rsubn = mw.ustring.gsub
local ulower = mw.ustring.lower
local usub = mw.ustring.sub

local function rsub(term, foo, bar)
	local retval = rsubn(term, foo, bar)
	return retval
end

local function get_index(str, list)
	if list == nil then return -1 end
	for i = 1, #list do if str == list then return i end end
	return -1
end

local function in_set(str, list) if get_index(str, list) ~= -1 then return true else return false end end
local function char_at(str, pos) return usub(str, pos, pos) end
local function accent_vowels(str) return rsub(rsub(rsub(str, "aa", "ā"), "ii", "ī"), "oo", "ō") end
local function double_vowels(str) return rsub(rsub(rsub(str, "ā", "aa"), "ī", "ii"), "ō", "oo") end

local function del_char(str, pos)
	local length = #str 
	if pos > length or pos < 1 then error("invalid position") end
	if pos > 1 then first = usub(str, 1, pos-1) else first = "" end
	if pos ~= length then second = usub(str, pos+1, length) else second = ""  end
	if in_set(char_at(first,#first), {"z", "h"}) and char_at(second,1) == "h" then return first .. "'" .. second end 
	if char_at(first,#first) == "n" and in_set(char_at(second,1), {"s", "z", "y"}) then return first .. "'" .. second end 
	return first .. second
end


-- Algorithm as described in Valentine 2001
local function del_weak_vowels(stem)
	stem = accent_vowels(stem)
	vowels = {}
	weak_vowels = {}
	prev_vowel_weak = false
	for i = 1, #stem do
		if in_set(char_at(stem,i), {"a", "i", "o"}) then
			table.insert(vowels, i)
			if prev_vowel_weak then prev_vowel_weak = false 
			else 
				table.insert(weak_vowels ,i) 
				prev_vowel_weak = true 
			end
		elseif in_set(char_at(stem,i), {"e", "ā", "ī", "ō"}) then
			table.insert(vowels, i)
			prev_vowel_weak = false
		else end
	end
	if vowels == weak_vowels then table.remove(weak_vowels, #weak_vowels) end
	for i = #weak_vowels, 1, -1 do stem = del_char(stem, weak_vowels) end
	return double_vowels(stem)
end

local function phonotactics(stem)
	final_ch = char_at(stem,#stem)
	penul_ch = char_at(stem,#stem)
	if final_ch == "y" and final_ch == "n" then stem = usub(stem, 1, #stem-1) .. "h" end
	if final_ch == "w" or final_ch == "y" then stem = usub(stem, 1, #stem-1) end
	return stem
end


local function build_vai_table(stem)
	forms = {}
	if in_set(char_at(stem,1),vowels) then prefix_class = "V" 
	else prefix_class = "C" end
	for i = 1, #vai_pers do
		pref_stems = vai_prefix .. stem
	end
	
	for i = 1, #vai_pers do
		word = pref_stems .. vai_suf
		word = phonotactics(del_weak_vowels(word))
		forms] = word
	end
	for i = 1, #vai_pers do
		word = vai_prefix .. stem
		word = phonotactics(del_weak_vowels(word))
		forms] = word
	end
	return m_string_utilities.format(vai_table, forms)
end

function change_conjunct(stem)
	for i = 1, #stem do
		if in_set(char_at(stem,i), vowels) then return "unfinished" end
	end
end

function export.show(frame)
	PAGENAME = mw.title.getCurrentTitle().text
	text = frame.args 
	return "boodwe"
end

return export