Module:User:Malku H₂n̥rés/he-filter

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

Eru's code

Lua error in package.lua at line 80: module 'Module:User:Sartma/he-translit' not found

Malku's code

Lua error in package.lua at line 80: module 'Module:User:Sartma/he-translit' not found


local export = {} 
MH = require("Module:User:Sartma/he-translit").MH_tr --TO CHANGE WHEN MOVED
lang = require("Module:languages").getByCode("he")
local N = mw.text.nowiki

local s = mw.ustring.gsub
local l = mw.ustring.lower
local M = mw.ustring.match

local U = mw.ustring.char
local bcc = "%s%z" .. 
	U(0x061C) .. U(0x200E) .. U(0x200F) .. U(0x202A) .. "-" .. U(0x202E)
	.. U(0x2066) .. "-" .. U(0x2069) .. "%-"
local word_end = "%f"
local word_start = "%f"

local a = ""
local V = ""

local c = { --for what may appear on wiki
	{"(.)%1", "%1"},
	{"", "v"},
	{"ḡ", "g"},
	{"ḏ", "d"},
	{"", "K"},
	{"p̄", "f"},
	{"", "t"},
	{"h", "K"},
	{"č", "C"},
	{"ž", "Z"},
	{"zh", "Z"},
	{"š", "S"},
	{"d", "j"},
	{"ṣ", "T"},
	{"t", "T"},
	{"", "k"},
	{"ś", "s"},
	{"sh", "S"},
	{"‘׳", "'"},
	{"“״", "″"},
	{"", ""}, --glottal stops, schwa, hyphen, 3ayin, hyphen
	{"ā́", "á"},
	{"ḗ", "é"},
	{"ī́", "í"},
	{"ṓ", "ó"},
	{"ū́", "ú"},
	{"", "a"},
	{"", "e"},
	{"", "i"},
	{"", "o"},
	{"", "u"},
	{"(" .. V .. ")i", "%1y"},
	{"(" .. V .. ")h(" .. word_end .. ")", "%1%2"}
}

local r = { --for generated MH tr
	{"(" .. V .. ")h(" .. word_end .. ")", "%1%2"},
	{"", ""}, --glottal stop & hyphen
	{"(" .. V .. ")h(" .. word_end .. ")", "%1%2"},
	{"()'h", "%1h"},
	{"h", "K"},
	{"zh", "Z"},
	{"sh", "S"},
	{"ts", "T"}
} 

local o = { --removing stress
	 = "a",
	 = "e",
	 = "i",
	 = "o",
	 = "u"
}

function export.convert(g, m)
	m = l(m)
	g = l(MH(g))
	for z = 1, #c do
		m = s(m, c, c)
	end
	for z = 1, #r do
		g = s(g, r, r)
	end

	--removing acute accents...
	--[[if (not M(m, a)) and M(g, a) then --...on the generated tr, if there's none on the manual
			g = s(g, ".", o)
	end--]]
	if (not M(g, a)) and M(m, a) then --...on the manual one if monosyllabic
		m = s(m, ".", o)
	end
	return g, m
end

function export.filter(g, m) --For a POS section: g = headword spelling, m = manual romanization
	local g, m = export.convert(g, m)
	if m == g then
		return true
	else
		return false
    end
end





function export.print_filter(frame)
	local data_page_title = frame.args
	local max_lines = frame.args and assert(tonumber(frame.args)) or 1000000
	local content = mw.title.new(data_page_title):getContent()
	local output = require "Module:array"()
	local data = assert(content:match("<pre>%s*(.-)%s*</pre>"), "expected pre tag in data page")
	local i = 0

	for line in data:gmatch "+" do
		local headword, translit = line:match "^(+)\t(+)$"
		if not headword then
			error("Following line did not match pattern:\n" .. line)
		end
		output:insert(("# %s %s | %s: %s"):format(N(headword), N(translit), MH(headword), tostring(export.filter(headword, translit))))
		i = i + 1
		if i >= max_lines then break end
	end
	return output:concat("\n")
end



function export.spelling(frame)
	local data_page_title = frame.args
	local max_lines = frame.args and assert(tonumber(frame.args)) or 1000000
	local content = mw.title.new(data_page_title):getContent()
	local output = require "Module:array"()
	local data = assert(content:match("<pre>%s*(.-)%s*</pre>"), "expected pre tag in data page")
	local i = 0

	for line in data:gmatch "+" do
		local headword, others = line:match "^(+)\t(+)$"
		if not headword then
			error("Following line did not match pattern:\n" .. line)
		end
		headword = N(headword)
		entry = lang:makeEntryName(headword)
		output:insert(("# <span class=\"Hebr\" lang=\"he\">]</span><sup>]</sup> %s"):format(entry, headword, entry, N(others)))

		i = i + 1
		if i >= max_lines then break end
	end
	return output:concat("\n")
end



function export.dunno(frame)
	local data_page_title = frame.args
	local max_lines = frame.args and assert(tonumber(frame.args)) or 1000000
	local content = mw.title.new(data_page_title):getContent()
	local output = require "Module:array"()
	local data = assert(content:match("<pre>%s*(.-)%s*</pre>"), "expected pre tag in data page")
	local i = 0

	for line in data:gmatch "+" do
		local headword = line:match "^(+)\t$"
		if not headword then
			error("Following line did not match pattern:\n" .. line)
		end
		headword = N(headword)
		entry = lang:makeEntryName(headword)
		output:insert(("# <span class=\"Hebr\" lang=\"he\">]</span><sup>]</sup> %s"):format(entry, headword, entry, MH(headword)))

		i = i + 1
		if i >= max_lines then break end
	end
	return output:concat("\n")
end



function export.draft(frame)
	local data_page_title = frame.args
	local min_lines = frame.args and assert(tonumber(frame.args)) or 0
	local max_lines = frame.args and assert(tonumber(frame.args)) or 1500
	local content = mw.title.new(data_page_title):getContent()
	local data = assert(content:match("<pre>%s*(.-)%s*</pre>"), "expected pre tag in data page")
	local i = 0

	local t, T, F = "", {"Correct"}, {"To check", {"Unpointed"}, {"Several spellings"}, {"Several romanizations"}, {"Lacking gershayim"}, {"Bad cute accent"}, {"Hyphen"}, {"Multiword"}, {"Lacking stress"}, {"Stress position"}, {"Schwa"}, {"Kamats (a/o)"}, {"Other"}} --to add: lacking pointing, lacking translit

	for line in data:gmatch "+" do
		i = i + 1
		if min_lines <= i then
			if i >= max_lines then
				i = i - 1
				break
			else
				local headword, translit = line:match "^(+)\t(+)$"
				if not headword then
					error("Following line did not match pattern:\n" .. line)
				else
					local g, m = export.convert(headword, translit)
					headword = N(headword)
					entry = lang:makeEntryName(headword)
					t = ("# <span class=\"Hebr\" lang=\"he\">]</span><sup>]</sup> %s • %s"):format(entry, headword, entry, N(translit), MH(headword))
					--t = ("# %s %s • %s (%s | %s)"):format(N(headword), N(translit), MH(headword), m, g)
					if g == m then
						table.insert(T, t)
					elseif not M(headword, "") then --unpointed
						table.insert(F, t)
					elseif M(g, "") then --several spellings
						table.insert(F, t)
					elseif M(m, "") then --several romanizations
						table.insert(F, t)
					elseif s(g, "″", "") == m then --lacking gershayim
						table.insert(F, t)
					elseif M(m, "&acute;") then --bad acute accent
						table.insert(F, t)
					elseif s(m, "", "") == s(g, "", "") then --hyphen
						table.insert(F, t)
					elseif M(g, " ") then --multiword
						table.insert(F, t)
					elseif not M(m, a) then --lacking stress
						table.insert(F, t)
					elseif s(m, ".", o) == s(g, ".", o) then --stress position
						table.insert(F, t)
					elseif s(m, "e", "") == s(g, "e", "") then --schwa
						table.insert(F, t)
					elseif s(s(m, "", "X"), "", "x") == s(s(g, "", "X"), "", "x") then --kamats (a/o)
						table.insert(F, t)
					else
						table.insert(F, t)
					end
				end
			end
		end
	end
	i = i + 1
	length = i - min_lines --true number, with i = where it stopped
	T = "==" .. T .. " (" .. (#T - 1)  .. "/" .. length .. ")=="
	F = "==" ..  F .. " (" .. (length - #T + 1) .. "/" .. length .. ")=="
	for z = 2, #F do
		F = "===" .. F .. " (" .. (#F - 1) .. "/" .. length .. ")==="
		F = table.concat(F, "\n")
	end
	return "Interval: [" .. min_lines .. ", " .. i .. "[\n" .. table.concat(F, "\n\n") .. "\n" .. table.concat(T, "\n")
end

return export