Module:User:IsomorphycSandbox/grc-ascii-searchability

--Update: this module is no longer in production use. The test was modestly --successful, but a more general solution is desired.

--This module is a temporary test to see if adding invisible Romanisations will --render Greek words more searchable in the Wiktionary search box and via --external search engines. If it seems undesirable or does not work it will be --removed within a week or so. Currently, this test applies only to nouns. At --this point, an unknown time interval is likely necessary for the changes to --propagate to all of the relevant places. --5 July 2015

local accent_m = require("Module:grc-accent")

local export = {}

local PHUCH = { ["Α"]="A",["Β"]="B",["Γ"]="G",["Δ"]="D",["Ε"]="E",["Ϝ"]="V",["Ζ"]="Z",["Η"]="E",["Θ"]="Th",["Ι"]="I",["Κ"]="K",["Λ"]="L",["Μ"]="M",["Ν"]="N",["Ξ"]="X",["Ο"]="O",["Π"]="P",["Ρ"]="R",["Σ"]="S",["Τ"]="T",["Υ"]="U",["Φ"]="Ph",["Χ"]="Ch",["Ψ"]="Ps",["Ω"]="O",["α"]="a",["β"]="b",["γ"]="g",["δ"]="d",["ε"]="e",["ϝ"]="v",["ζ"]="z",["η"]="e",["θ"]="th",["ι"]="i",["κ"]="k",["λ"]="l",["μ"]="m",["ν"]="n",["ξ"]="x",["ο"]="o",["π"]="p",["ρ"]="r",["σ"]="s",["ς"]="s",["τ"]="t",["υ"]="u",["φ"]="ph",["χ"]="ch",["ψ"]="ps",["ω"]="o"} local PHYCH = { ["Α"]="A",["Β"]="B",["Γ"]="G",["Δ"]="D",["Ε"]="E",["Ϝ"]="V",["Ζ"]="Z",["Η"]="E",["Θ"]="Th",["Ι"]="I",["Κ"]="K",["Λ"]="L",["Μ"]="M",["Ν"]="N",["Ξ"]="X",["Ο"]="O",["Π"]="P",["Ρ"]="R",["Σ"]="S",["Τ"]="T",["Υ"]="Y",["Φ"]="Ph",["Χ"]="Ch",["Ψ"]="Ps",["Ω"]="O",["α"]="a",["β"]="b",["γ"]="g",["δ"]="d",["ε"]="e",["ϝ"]="v",["ζ"]="z",["η"]="e",["θ"]="th",["ι"]="i",["κ"]="k",["λ"]="l",["μ"]="m",["ν"]="n",["ξ"]="x",["ο"]="o",["π"]="p",["ρ"]="r",["σ"]="s",["ς"]="s",["τ"]="t",["υ"]="y",["φ"]="ph",["χ"]="ch",["ψ"]="ps",["ω"]="o"} local FUCH = { ["Α"]="A",["Β"]="B",["Γ"]="G",["Δ"]="D",["Ε"]="E",["Ϝ"]="V",["Ζ"]="Z",["Η"]="E",["Θ"]="Th",["Ι"]="I",["Κ"]="K",["Λ"]="L",["Μ"]="M",["Ν"]="N",["Ξ"]="X",["Ο"]="O",["Π"]="P",["Ρ"]="R",["Σ"]="S",["Τ"]="T",["Υ"]="U",["Φ"]="F",["Χ"]="Ch",["Ψ"]="Ps",["Ω"]="O",["α"]="a",["β"]="b",["γ"]="g",["δ"]="d",["ε"]="e",["ϝ"]="v",["ζ"]="z",["η"]="e",["θ"]="th",["ι"]="i",["κ"]="k",["λ"]="l",["μ"]="m",["ν"]="n",["ξ"]="x",["ο"]="o",["π"]="p",["ρ"]="r",["σ"]="s",["ς"]="s",["τ"]="t",["υ"]="u",["φ"]="ph",["χ"]="ch",["ψ"]="ps",["ω"]="o"} local FYCH = { ["Α"]="A",["Β"]="B",["Γ"]="G",["Δ"]="D",["Ε"]="E",["Ϝ"]="V",["Ζ"]="Z",["Η"]="E",["Θ"]="Th",["Ι"]="I",["Κ"]="K",["Λ"]="L",["Μ"]="M",["Ν"]="N",["Ξ"]="X",["Ο"]="O",["Π"]="P",["Ρ"]="R",["Σ"]="S",["Τ"]="T",["Υ"]="Y",["Φ"]="Ph",["Χ"]="Ch",["Ψ"]="Ps",["Ω"]="O",["α"]="a",["β"]="b",["γ"]="g",["δ"]="d",["ε"]="e",["ϝ"]="v",["ζ"]="z",["η"]="e",["θ"]="th",["ι"]="i",["κ"]="k",["λ"]="l",["μ"]="m",["ν"]="n",["ξ"]="x",["ο"]="o",["π"]="p",["ρ"]="r",["σ"]="s",["ς"]="s",["τ"]="t",["υ"]="y",["φ"]="ph",["χ"]="kh",["ψ"]="ps",["ω"]="o"} local PHUKH = { ["Α"]="A",["Β"]="B",["Γ"]="G",["Δ"]="D",["Ε"]="E",["Ϝ"]="V",["Ζ"]="Z",["Η"]="E",["Θ"]="Th",["Ι"]="I",["Κ"]="K",["Λ"]="L",["Μ"]="M",["Ν"]="N",["Ξ"]="X",["Ο"]="O",["Π"]="P",["Ρ"]="R",["Σ"]="S",["Τ"]="T",["Υ"]="U",["Φ"]="Ph",["Χ"]="Kh",["Ψ"]="Ps",["Ω"]="O",["α"]="a",["β"]="b",["γ"]="g",["δ"]="d",["ε"]="e",["ϝ"]="v",["ζ"]="z",["η"]="e",["θ"]="th",["ι"]="i",["κ"]="k",["λ"]="l",["μ"]="m",["ν"]="n",["ξ"]="x",["ο"]="o",["π"]="p",["ρ"]="r",["σ"]="s",["ς"]="s",["τ"]="t",["υ"]="u",["φ"]="ph",["χ"]="kh",["ψ"]="ps",["ω"]="o"} local PHYKH = { ["Α"]="A",["Β"]="B",["Γ"]="G",["Δ"]="D",["Ε"]="E",["Ϝ"]="V",["Ζ"]="Z",["Η"]="E",["Θ"]="Th",["Ι"]="I",["Κ"]="K",["Λ"]="L",["Μ"]="M",["Ν"]="N",["Ξ"]="X",["Ο"]="O",["Π"]="P",["Ρ"]="R",["Σ"]="S",["Τ"]="T",["Υ"]="Y",["Φ"]="Ph",["Χ"]="Kh",["Ψ"]="Ps",["Ω"]="O",["α"]="a",["β"]="b",["γ"]="g",["δ"]="d",["ε"]="e",["ϝ"]="v",["ζ"]="z",["η"]="e",["θ"]="th",["ι"]="i",["κ"]="k",["λ"]="l",["μ"]="m",["ν"]="n",["ξ"]="x",["ο"]="o",["π"]="p",["ρ"]="r",["σ"]="s",["ς"]="s",["τ"]="t",["υ"]="y",["φ"]="ph",["χ"]="kh",["ψ"]="ps",["ω"]="o"} local FUKH = { ["Α"]="A",["Β"]="B",["Γ"]="G",["Δ"]="D",["Ε"]="E",["Ϝ"]="V",["Ζ"]="Z",["Η"]="E",["Θ"]="Th",["Ι"]="I",["Κ"]="K",["Λ"]="L",["Μ"]="M",["Ν"]="N",["Ξ"]="X",["Ο"]="O",["Π"]="P",["Ρ"]="R",["Σ"]="S",["Τ"]="T",["Υ"]="U",["Φ"]="F",["Χ"]="Kh",["Ψ"]="Ps",["Ω"]="O",["α"]="a",["β"]="b",["γ"]="g",["δ"]="d",["ε"]="e",["ϝ"]="v",["ζ"]="z",["η"]="e",["θ"]="th",["ι"]="i",["κ"]="k",["λ"]="l",["μ"]="m",["ν"]="n",["ξ"]="x",["ο"]="o",["π"]="p",["ρ"]="r",["σ"]="s",["ς"]="s",["τ"]="t",["υ"]="u",["φ"]="ph",["χ"]="kh",["ψ"]="ps",["ω"]="o"} local FYKH = { ["Α"]="A",["Β"]="B",["Γ"]="G",["Δ"]="D",["Ε"]="E",["Ϝ"]="V",["Ζ"]="Z",["Η"]="E",["Θ"]="Th",["Ι"]="I",["Κ"]="K",["Λ"]="L",["Μ"]="M",["Ν"]="N",["Ξ"]="X",["Ο"]="O",["Π"]="P",["Ρ"]="R",["Σ"]="S",["Τ"]="T",["Υ"]="Y",["Φ"]="Ph",["Χ"]="Kh",["Ψ"]="Ps",["Ω"]="O",["α"]="a",["β"]="b",["γ"]="g",["δ"]="d",["ε"]="e",["ϝ"]="v",["ζ"]="z",["η"]="e",["θ"]="th",["ι"]="i",["κ"]="k",["λ"]="l",["μ"]="m",["ν"]="n",["ξ"]="x",["ο"]="o",["π"]="p",["ρ"]="r",["σ"]="s",["ς"]="s",["τ"]="t",["υ"]="y",["φ"]="ph",["χ"]="kh",["ψ"]="ps",["ω"]="o"} local beta = { ["Α"]="A",["Β"]="B",["Γ"]="G",["Δ"]="D",["Ε"]="E",["Ϝ"]="V",["Ζ"]="Z",["Η"]="H",["Θ"]="Q",["Ι"]="I",["Κ"]="K",["Λ"]="L",["Μ"]="M",["Ν"]="N",["Ξ"]="C",["Ο"]="O",["Π"]="P",["Ρ"]="R",["Σ"]="S",["Τ"]="T",["Υ"]="U",["Φ"]="F",["Χ"]="X",["Ψ"]="Y",["Ω"]="W",["α"]="a",["β"]="b",["γ"]="g",["δ"]="d",["ε"]="e",["ϝ"]="v",["ζ"]="z",["η"]="h",["θ"]="q",["ι"]="i",["κ"]="k",["λ"]="l",["μ"]="m",["ν"]="n",["ξ"]="c",["ο"]="o",["π"]="p",["ρ"]="r",["σ"]="s",["ς"]="s",["τ"]="t",["υ"]="u",["φ"]="f",["χ"]="x",["ψ"]="y",["ω"]="w"}

local ts = { PHUCH, PHYCH, FUCH, FYCH, PHUKH, PHYKH, FUKH, FYKH, beta }

function t1(t, w)	local gs = {} for i = 1, mw.ustring.len(w) do gs[i] = t[mw.ustring.sub(w, i, i)] or mw.ustring.sub(w, i, i) end return table.concat(gs) end

function print_transliterations(head) w = accent_m.strip_accent(head) local us, html = {}, {' '} for i,t in ipairs(ts) do 		us[t1(t, w)] = {} end for u,x in pairs(us) do		html[#html+1] = u		html[#html+1] = " " end html[#html+1] = ' may be Romanised forms of Ancient Greek '..head..'. ' 	return table.concat(html) end -- e.g., appends to the headword for χρόνος this: khronos xronos chronos may be Romanised forms of Ancient Greek χρόνος. function export.ascii(frame) local args = frame:getParent.args local head = args['head'] or mw.title.getCurrentTitle.text return print_transliterations(head) end

return export