Module:Swadesh

Hallo, je bent hier gekomen op zoek naar de betekenis van het woord Module:Swadesh. In DICTIOUS vind je niet alleen alle woordenboekbetekenissen van het woord Module:Swadesh, maar kom je ook meer te weten over de etymologie, de kenmerken en hoe je Module:Swadesh in enkelvoud en meervoud uitspreekt. Alles wat je moet weten over het woord Module:Swadesh is hier. De definitie van het woord Module:Swadesh zal u helpen preciezer en correcter te zijn bij het spreken of schrijven van uw teksten. Kennis van de definitie vanModule:Swadesh, maar ook van die van andere woorden, verrijkt uw woordenschat en verschaft u meer en betere taalkundige bronnen.

Documentatie voor deze module kan aangemaakt worden op de volgende pagina: Module:Swadesh/doc

local export = {}

local m_links = require("Module:links")
local m_ipa = require("Module:IPA-nl")

local Nederlands = {
	"] (<span style=\"font-variant:small-caps;\">1sg</span>)",
	"] (<span style=\"font-variant:small-caps;\">2sg</span>)",
	"], ], ] (<span style=\"font-variant:small-caps;\">3sg</span>)",
	"] (<span style=\"font-variant:small-caps;\">1pl</span>)",
	"] (<span style=\"font-variant:small-caps;\">2pl</span>)",
	"] (<span style=\"font-variant:small-caps;\">3pl</span>)",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"] (adult male)",
	"] (human being)",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"] (of a tree)",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"] (noun)",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"] (organ)",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ] (as in a bed)",
	"to ]",
	"to ]",
	"to ] (intransitive)",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"to ]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"to ]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"] (as a knife)",
	"] (as a knife)",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]",
	"]"
}
--array - list of 207 objects in this form {gloss=term}
local data = {}

function export.python_dictionary(frame)
	local args = frame:getParent().args
	local dataurl = args
	if args then dataurl = dataurl .. '/' .. args end
	local data = require("Module:Swadesh/data/" .. dataurl)
	local lang = require("Module:languages").getByCode(args.lang, "lang", "allow etym")
	local res = "{'name': '" .. lang:getCanonicalName()
	if data ~= nil then res = res .. ' (' .. data .. ')' end
	res = res .. "',"
	
	for word = 1, #Nederlands do
		res = res .. "'" .. word .. "': ["
		if data ~= nil then
			for _, termdata in ipairs(data) do
				local translit = (lang:transliterate(termdata.alt or termdata.term))
				res = res .. '{'
				if termdata.term then res = res .. "'term': '" .. termdata.term:gsub("'", "&#39;") .. "', " end
				if termdata.alt then res = res .. "'alt': '" .. termdata.alt:gsub("'", "&#39;") .. "', " end
				if termdata.tr or translit then res = res .. "'translit': '" ..  (termdata.tr or translit):gsub("'", "&#39;") .. "', " end
				if termdata.ts then res = res .. "'transcript': '" ..  termdata.ts:gsub("'", "&#39;") .. "', " end
				if termdata.id then res = res .. "'id': '" ..  termdata.id:gsub("'", "&#39;") .. "', " end
				if termdata.ipa then res = res .. "'ipa': '" ..  termdata.ipa:gsub("'", "&#39;") .. "', " end
				if termdata.nolink then res = res .. "'nolink': '" .. termdata.nolink:gsub("'", "&#39;") .. "', " end
				if termdata.notes then res = res .. "'notes': '" ..  termdata.notes:gsub("'", "&#39;") .. "', " end
				res = res .. '},'
			end
		end
		res = res .. "],"
	end
	res = res .. "}"
	
	return "<pre>" .. require("Module:string/nowiki")(res) .. "</pre>"
end


function export.show(frame)
	local parent_args = frame:getParent().args
	local data = {}
	local langs = {}
	
	local res = mw.html.create("table"):addClass("wikitable sortable")
	
	local headers = res:tag("tr")
	for _, text in ipairs { "№", "Nederlands" } do
		headers:tag("th"):node(text)
	end

	local params = {
		 = {list = true, disallow_holes = true},
		 = {list = true, allow_holes = true},
		 = {type = "boolean"},
		 = {type = "boolean"},
		 = {type = "number"},
		 = {type = "number"},
	}

	local args = require("Module:parameters").process(parent_args, params, nil, "Swadesh", "show")

	local from = args.from or 1
	local to = args.to or #Nederlands

	for i, arg in ipairs(args) do
		local lang = arg
		local header = arg
		local lang_obj = require("Module:languages").getByCode(lang, i, "allow etym")
		langs = lang_obj
		local var = args
		if var then
			arg = arg .. "/" .. var
		end
		local data_module = require("Module:Swadesh/data/" .. arg)
		data = data_module
		local header = lang_obj:getCanonicalName()
		local header_in_data = data_module
		if header_in_data ~= nil and args.translit then
			header = header .. " (" .. header_in_data .. ")"
		end
		local nativename = data_module
		if nativename ~= nil then
			header = header .. "<br><small>" .. m_links.full_link{lang = lang_obj, alt = nativename} .. "</small>"
		end
		local count = 0
		for k, v in pairs(data_module) do
    		if (type(k) == "number") then count = count + 1 end
    	end
		header = header .. "<br><small><sup>]</sup></small>"
		headers:tag("th"):node(header)
	end
	
	local show_ipa = #args < 2 and not args.translit
	if show_ipa then
		show_ipa = args.ipa
		
		-- do not display IPA by default for reconstructed languages
		if not show_ipa then
			show_ipa = not langs:hasType("reconstructed")
		end
		
		if show_ipa then
			local has_ipa = false
			for word = from, to do
				if data then
					for _, termdata in ipairs(data) do
						if termdata.ipa then
							has_ipa = true
							break
						end
					end
				end
				if has_ipa then break end
			end
			show_ipa = has_ipa
		end
		
		if show_ipa then
			local key = ""
			if mw.loadData("Module:IPA/data").langs_with_infopages:getCode()] then
				key = "<br><small>(:getCanonicalName() .. " pronunciation|key]])</small>"
			end
			headers:tag("th"):node("IPA" .. key)
		end
	end

	for word = from, to do
		local row = mw.html.create("tr")
		row:tag("td"):node(word)
		row:tag("td"):node(Nederlands)
		
		for lang, arg in ipairs(args) do
			local res = ""
			local count = 0
			local terms = data
			local lang_obj = langs
			if terms then
				for _, termdata in ipairs(terms) do
					if count ~= 0 then res = res .. ", " end
					local term = termdata.term
					if args then
						res = res .. '<span class="swadesh-translit">'
						local alt = termdata.ts or termdata.tr or (lang_obj:transliterate(termdata.alt or term)) or term
							or (termdata.ipa and '<span class="IPA">' .. termdata.ipa .. "</span>")
						if not termdata.nolink and term ~= nil and term ~= "" then
							res = res .. m_links.language_link{lang = lang_obj, term = term,
								alt = alt}
						else
							res = res .. alt
						end
					else
						res = res .. '<span class="swadesh-term">'
						if termdata.nolink == nil then
							res = res .. m_links.full_link{lang = lang_obj, term = term, alt = termdata.alt, tr = termdata.tr, ts = termdata.ts, id = termdata.id}
						else
							res = res .. term
						end
					end
					local notes = termdata.notes
					if notes then
						if #args < 2 then res = res .. " (''<span class=\"swadesh-note\">" .. notes .. "</span>'')"
						else res = res .. '<abbr title = "' .. notes .. ">*</abbr>" end
					end
					res = res .. "</span>"
					count = count + 1
				end
			end
			row:tag("td"):node(res)
		end
		
		if show_ipa then
			local ipas = ""
			local count = 0
			if data then
				for _, termdata in ipairs(data) do
					if count ~= 0 then
						ipas = ipas .. ", "
					end
					if termdata.ipa then
						ipas = ipas .. '<span class="IPA">' .. termdata.ipa .. "</span>"
						count = count + 1
					end
				end
			end
			row:tag("td"):node(ipas)
		end
		res:node(row)
	end
	
	
	return res;
end

return export