Module:links/data: Difference between revisions

From Linguifex
Jump to navigation Jump to search
(Created page with "local data = {} data.high_memory_entries = { "a", "animal", "book", "coffee", "do", "e", "language", "night", "smoke", "son", "sun", "water", "wind", } local U...")
 
No edit summary
Tag: Reverted
Line 1: Line 1:
local encode = mw.text.encode
local u = mw.ustring.char
local data = {}
local data = {}


data.high_memory_entries = {
data.ignore_cap = {
"a",
["ko"] = true,
"animal",
"book",
"coffee",
"do",
"e",
"language",
"night",
"smoke",
"son",
"sun",
"water",
"wind",
}
}


data.phonetic_extraction = {
["th"] = "Module:th",
["km"] = "Module:km",
}


local U = mw.ustring.char
data.pos_tags = {
local soft_hyphen = U(0xAD)
["a"] = "adjective",
["adv"] = "adverb",
["int"] = "interjection",
["n"] = "noun",
["pron"] = "pronoun",
["v"] = "verb",
["vi"] = "intransitive verb",
["vt"] = "transitive verb",
["vti"] = "transitive and intransitive verb",
}


--[[ The "actual title" is the page name with the prefix "Unsupported titles/" removed.
--[[ The "actual title" is the page name with the prefix "Unsupported titles/" removed.
Line 25: Line 28:
data.unsupported_titles = {
data.unsupported_titles = {
[" "] = "Space",
[" "] = "Space",
["# #"] = "Enclosing number signs",
["#"] = "Number sign",
["#MeToo"] = "MeToo",
["#MeTooed"] = "MeTooed",
["#MeTooing"] = "MeTooing",
["#MeToos"] = "MeToos",
["&"] = "Amp",
["¯\\_(ツ)_/¯"] = "¯\\ (ツ) /¯",
["¯_(ツ)_/¯"] = "¯ (ツ) /¯",
["(^_^)"] = "(^ ^)",
["*_*"] = "* *",
["."] = "Full stop",
[".."] = "Double period",
["./."] = "Period slash period",
[": :"] = ": :",
[":"] = ":",
[":-{"] = "Colon hyphen left curly bracket",
[":{"] = "Colon left curly bracket",
[":|"] = "Colon vertical line",
["=_="] = "= =",
["[ ]"] = "Square brackets",
["["] = "Left square bracket",
["[…]"] = "Square bracketed ellipsis",
["[...]"] = "Left square bracket ... right square bracket",
["[-0-]"] = "Australian Aboriginal Flag emoticon alternative",
["[citation needed]"] = "Square bracketed citation needed",
["[-o-]"] = "Australian Aboriginal Flag emoticon",
["]"] = "Right square bracket",
["^_^"] = "^ ^",
["_ _"] = "Underscore space underscore",
["-_-"] = "- -",
["_"] = "Underscore",
["{ }"] = "Curly brackets",
["{"] = "Left curly bracket",
["{"] = "Left curly bracket",
["| |"] = "Enclosing vertical lines",
["|"] = "Vertical line",
["-||-"] = "Hyphen vertical line vertical line hyphen",
["||"] = "Vertical line vertical line",
["}"] = "Right curly bracket",
["}"] = "Right curly bracket",
["["] = "Left square bracket",
["</s>"] = "End s tag",
["]"] = "Right square bracket",
["< />"] = "Less than trailing slash greater than",
["< > </ >"] = "HTML start tag end tag",
["< >"] = "Enclosing less than greater than",
["<!-- -->"] = "HTML comment",
["<-"] = "Less than hyphen",
["<"] = "Less than",
["<"] = "Less than",
[">"] = "Greater than",
["</3"] = "Less than slash three",
["<\\3"] = "Less than backslash three",
["<<"] = "Double less than",
["<<<"] = "Triple less than",
["<="] = "Less than equal",
["<>"] = "Less than greater than",
["<3"] = "Less than three",
["<g>"] = "g tag",
["=<"] = "Equal less than",
["=<"] = "Equal less than",
["=>"] = "Equal greater than",
["=>"] = "Equal greater than",
[">="] = "Greater than equal",
[">"] = "Greater than",
["<="] = "Less than equal",
["->"] = "Hyphen greater than",
["->"] = "Hyphen greater than",
["<-"] = "Less than hyphen",
[">_<"] = "Greater than low line less than",
[">_<"] = "Greater than low line less than",
["::"] = "Double colon",
[">="] = "Greater than equal",
[": :"] = "Enclosing colons",
[">>"] = "Double greater than",
[":="] = "Colon equals",
[">>>"] = "Triple greater than",
[":Þ"] = "Colon capital thorn",
["×_×"] = "× ×",
[":("] = "Colon left paren",
["9_9"] = "9 9",
[":)"] = "Colon right paren",
["<>"] = "Less than greater than",
["<3"] = "Less than three",
["</3"] = "Less than slash three",
["< >"] = "Enclosing less than greater than",
["< />"] = "Less than trailing slash greater than",
["< > </ >"] = "HTML start tag end tag",
["<!-- -->"] = "HTML comment",
["<g>"] = "g tag",
[":-("] = "Colon hyphen left paren",
[":-)"] = "Colon hyphen right paren",
["|"] = "Vertical line",
["||"] = "Vertical line vertical line",
["| |"] = "Enclosing vertical lines",
["C#"] = "C sharp",
["C#"] = "C sharp",
["#"] = "Number sign",
["# #"] = "Enclosing number signs",
[":"] = "Colon",
[".."] = "Double period",
["."] = "Full stop",
["_"] = "Low line",
["-_-"] = "Low line interfix",
[U(0xFFFD)] = "Replacement character",
[U(0x1680)] = "Ogham space",
["[ ]"] = "Square brackets",
["{ }"] = "Curly brackets",
["[…]"] = "Square bracketed ellipsis",
["_ _"] = "Enclosing low lines",
["C|N>K"] = "C through N to K",
["C|N>K"] = "C through N to K",
["#MeToo"] = "MeToo",
["eq #"] = "eq number sign",
["f##k"] = "f double number sign k",
["f##ked"] = "f double number sign ked",
["f##king"] = "f double number sign king",
["f##ks"] = "f double number sign ks",
["hr #"] = "hr number sign",
["n_n"] = "n n",
["O_O"] = "O O",
["O_o"] = "O o",
["o_O"] = "o O",
["o_o"] = "o o",
["snake_case"] = "snake case",
["T_T"] = "T T",
["u_u"] = "u u",
["X_X"] = "X X",
["x_x"] = "x x",
["x86_64"] = "x86 64",
["λοπαδοτεμαχοσελαχογαλεοκρανιολειψανοδριμυποτριμματοσιλφιοκαραβομελιτοκατακεχυμενοκιχλεπικοσσυφοφαττοπεριστεραλεκτρυονοπτοκεφαλλιοκιγκλοπελειολαγῳοσιραιοβαφητραγανοπτερύγων"] = "Ancient Greek dish",
["о/."] = "о slash dot",
["о/."] = "о slash dot",
["ಠ_ಠ"] = "ಠ ಠ",
["ಥ_ಥ"] = "ಥ ಥ",
["┬─┬ノ( º _ ºノ)"] = "┬─┬ノ( º ºノ)",
["กรุงเทพมหานคร อมรรัตนโกสินทร์ มหินทรายุธยา มหาดิลกภพ นพรัตนราชธานีบูรีรมย์ อุดมราชนิเวศน์มหาสถาน อมรพิมานอวตารสถิต สักกะทัตติยวิษณุกรรมประสิทธิ์"] = "Thai name of Bangkok",
["กรุงเทพมหานคร อมรรัตนโกสินทร์ มหินทรายุธยา มหาดิลกภพ นพรัตนราชธานีบูรีรมย์ อุดมราชนิเวศน์มหาสถาน อมรพิมานอวตารสถิต สักกะทัตติยวิษณุกรรมประสิทธิ์"] = "Thai name of Bangkok",
["λοπαδοτεμαχοσελαχογαλεοκρανιολειψανοδριμυποτριμματοσιλφιοκαραβομελιτοκατακεχυμενοκιχλ" .. soft_hyphen .. "επικοσσυφοφαττοπεριστεραλεκτρυονοπτοκεφαλλιοκιγκλοπελειολαγῳοσιραιοβαφητραγανοπτερύγων"] = "Ancient Greek dish",
[u(0x1680)] = "Ogham space",
[":≠"] = ":≠",
[u(0x3000)] = "Ideographic space",
["S:t"] = "S:t",
[u(0xFFFD)] = "Replacement character",
["S:ta"] = "S:ta",
}
["c:a"] = "c:a",
 
["n:a"] = "n:a",
data.display_change = {
["n:o"] = "n:o",
[" "] = "] [", -- Space
["n:r"] = "n:r",
[u(0x00A0)] = "]" .. u(0x00A0) .. "[", -- No-break space
["s:a"] = "s:a",
[u(0x180E)] = "]" .. u(0x180E) .. "[", -- Mongolian vowel separator
["st:a"] = "st:a",
[u(0x2000)] = "]" .. u(0x2000) .. "[", -- En quad
["v:a"] = "v:a",
[u(0x2001)] = "]" .. u(0x2001) .. "[", -- Em quad
[u(0x2002)] = "]" .. u(0x2002) .. "[", -- En space
[u(0x2003)] = "]" .. u(0x2003) .. "[", -- Em space
[u(0x2004)] = "]" .. u(0x2004) .. "[", -- Three-per-em space
[u(0x2005)] = "]" .. u(0x2005) .. "[", -- Four-per-em space
[u(0x2006)] = "]" .. u(0x2006) .. "[", -- Six-per-em space
[u(0x2007)] = "]" .. u(0x2007) .. "[", -- Figure space
[u(0x2008)] = "]" .. u(0x2008) .. "[", -- Punctuation space
[u(0x2009)] = "]" .. u(0x2009) .. "[", -- Thin space
[u(0x200A)] = "]" .. u(0x200A) .. "[", -- Hair space
[u(0x202F)] = "]" .. u(0x202F) .. "[", -- Narrow no-break space
[u(0x205F)] = "]" .. u(0x205F) .. "[", -- Medium mathematical space
[u(0x3000)] = "]" .. u(0x3000) .. "[", -- Ideographic space
}
}


for i, item in ipairs(data.high_memory_entries) do
-- Valid URI schemes in external links, which therefore have to be escaped if used in entry names (e.g. [[sms:a]]).
data.high_memory_entries[i] = nil
local uri_schemes = {
data.high_memory_entries[item] = true
"bitcoin:",
"ftp://",
"ftps://",
"geo:",
"git://",
"gopher://",
"http://",
"https://",
"irc:",
"ircs:",
"magnet:",
"mailto:",
"mms://",
"news:",
"nntp://",
"redis://",
"sftp://",
"sip:",
"sips:",
"sms:",
"ssh://",
"svn://",
"tel:",
"telnet://",
"urn:",
"worldwind://",
"xmpp:",
}
-- Convert into lookup table.
local uri_lookup = {}
for _, scheme in ipairs(uri_schemes) do
uri_lookup[scheme] = encode(scheme, ":")
end
end
data.uri_schemes = uri_lookup


return data
return data

Revision as of 14:04, 29 July 2023



local encode = mw.text.encode
local u = mw.ustring.char
local data = {}

data.ignore_cap = {
	["ko"] = true,
}

data.phonetic_extraction = {
	["th"] = "Module:th",
	["km"] = "Module:km",
}

data.pos_tags = {
	["a"] = "adjective",
	["adv"] = "adverb",
	["int"] = "interjection",
	["n"] = "noun",
	["pron"] = "pronoun",
	["v"] = "verb",
	["vi"] = "intransitive verb",
	["vt"] = "transitive verb",
	["vti"] = "transitive and intransitive verb",
}

--[[	The "actual title" is the page name with the prefix "Unsupported titles/" removed.
		["displayed_title"] = "actual title"	]]
data.unsupported_titles = {
	[" "] = "Space",
	["# #"] = "Enclosing number signs",
	["#"] = "Number sign",
	["#MeToo"] = "MeToo",
	["#MeTooed"] = "MeTooed",
	["#MeTooing"] = "MeTooing",
	["#MeToos"] = "MeToos",
	["&amp;"] = "Amp",
	[\\_(ツ)_/¯"] = \\ (ツ) /¯",
	["¯_(ツ)_/¯"] = "¯ (ツ) /¯",
	["(^_^)"] = "(^ ^)",
	["*_*"] = "* *",
	["."] = "Full stop",
	[".."] = "Double period",
	["./."] = "Period slash period",
	[": :"] = ": :",
	[":"] = ":",
	[":-{"] = "Colon hyphen left curly bracket",
	[":{"] = "Colon left curly bracket",
	[":|"] = "Colon vertical line",
	["=_="] = "= =",
	["[ ]"] = "Square brackets",
	["["] = "Left square bracket",
	["[…]"] = "Square bracketed ellipsis",
	["[...]"] = "Left square bracket ... right square bracket",
	["[-0-]"] = "Australian Aboriginal Flag emoticon alternative",
	["[citation needed]"] = "Square bracketed citation needed",
	["[-o-]"] = "Australian Aboriginal Flag emoticon",
	["]"] = "Right square bracket",
	["^_^"] = "^ ^",
	["_ _"] = "Underscore space underscore",
	["-_-"] = "- -",
	["_"] = "Underscore",
	["{ }"] = "Curly brackets",
	["{"] = "Left curly bracket",
	["| |"] = "Enclosing vertical lines",
	["|"] = "Vertical line",
	["-||-"] = "Hyphen vertical line vertical line hyphen",
	["||"] = "Vertical line vertical line",
	["}"] = "Right curly bracket",
	["</s>"] = "End s tag",
	["< />"] = "Less than trailing slash greater than",
	["< > </ >"] = "HTML start tag end tag",
	["< >"] = "Enclosing less than greater than",
	["<!-- -->"] = "HTML comment",
	["<-"] = "Less than hyphen",
	["<"] = "Less than",
	["</3"] = "Less than slash three",
	["<\\3"] = "Less than backslash three",
	["<<"] = "Double less than",
	["<<<"] = "Triple less than",
	["<="] = "Less than equal",
	["<>"] = "Less than greater than",
	["<3"] = "Less than three",
	["<g>"] = "g tag",
	["=<"] = "Equal less than",
	["=>"] = "Equal greater than",
	[">"] = "Greater than",
	["->"] = "Hyphen greater than",
	[">_<"] = "Greater than low line less than",
	[">="] = "Greater than equal",
	[">>"] = "Double greater than",
	[">>>"] = "Triple greater than",
	["×_×"] = "× ×",
	["9_9"] = "9 9",
	["C#"] = "C sharp",
	["C|N>K"] = "C through N to K",
	["eq #"] = "eq number sign",
	["f##k"] = "f double number sign k",
	["f##ked"] = "f double number sign ked",
	["f##king"] = "f double number sign king",
	["f##ks"] = "f double number sign ks",
	["hr #"] = "hr number sign",
	["n_n"] = "n n",
	["O_O"] = "O O",
	["O_o"] = "O o",
	["o_O"] = "o O",
	["o_o"] = "o o",
	["snake_case"] = "snake case",
	["T_T"] = "T T",
	["u_u"] = "u u",
	["X_X"] = "X X",
	["x_x"] = "x x",
	["x86_64"] = "x86 64",
	["λοπαδοτεμαχοσελαχογαλεοκρανιολειψανοδριμυποτριμματοσιλφιοκαραβομελιτοκατακεχυμενοκιχλεπικοσσυφοφαττοπεριστεραλεκτρυονοπτοκεφαλλιοκιγκλοπελειολαγῳοσιραιοβαφητραγανοπτερύγων"] = "Ancient Greek dish",
	["о/."] = "о slash dot",
	["ಠ_ಠ"] = "ಠ ಠ",
	["ಥ_ಥ"] = "ಥ ಥ",
	["┬─┬ノ( º _ ºノ)"] = "┬─┬ノ( º ºノ)",
	["กรุงเทพมหานคร อมรรัตนโกสินทร์ มหินทรายุธยา มหาดิลกภพ นพรัตนราชธานีบูรีรมย์ อุดมราชนิเวศน์มหาสถาน อมรพิมานอวตารสถิต สักกะทัตติยวิษณุกรรมประสิทธิ์"] = "Thai name of Bangkok",
	[u(0x1680)] = "Ogham space",
	[u(0x3000)] = "Ideographic space",
	[u(0xFFFD)] = "Replacement character",
}

data.display_change = {
	[" "] = "] [", -- Space
	[u(0x00A0)] = "]" .. u(0x00A0) .. "[", -- No-break space
	[u(0x180E)] = "]" .. u(0x180E) .. "[", -- Mongolian vowel separator
	[u(0x2000)] = "]" .. u(0x2000) .. "[", -- En quad
	[u(0x2001)] = "]" .. u(0x2001) .. "[", -- Em quad
	[u(0x2002)] = "]" .. u(0x2002) .. "[", -- En space
	[u(0x2003)] = "]" .. u(0x2003) .. "[", -- Em space
	[u(0x2004)] = "]" .. u(0x2004) .. "[", -- Three-per-em space
	[u(0x2005)] = "]" .. u(0x2005) .. "[", -- Four-per-em space
	[u(0x2006)] = "]" .. u(0x2006) .. "[", -- Six-per-em space
	[u(0x2007)] = "]" .. u(0x2007) .. "[", -- Figure space
	[u(0x2008)] = "]" .. u(0x2008) .. "[", -- Punctuation space
	[u(0x2009)] = "]" .. u(0x2009) .. "[", -- Thin space
	[u(0x200A)] = "]" .. u(0x200A) .. "[", -- Hair space
	[u(0x202F)] = "]" .. u(0x202F) .. "[", -- Narrow no-break space
	[u(0x205F)] = "]" .. u(0x205F) .. "[", -- Medium mathematical space
	[u(0x3000)] = "]" .. u(0x3000) .. "[", -- Ideographic space
}

-- Valid URI schemes in external links, which therefore have to be escaped if used in entry names (e.g. [[sms:a]]).
local uri_schemes = {
	"bitcoin:",
	"ftp://",
	"ftps://",
	"geo:",
	"git://",
	"gopher://",
	"http://",
	"https://",
	"irc:",
	"ircs:",
	"magnet:",
	"mailto:",
	"mms://",
	"news:",
	"nntp://",
	"redis://",
	"sftp://",
	"sip:",
	"sips:",
	"sms:",
	"ssh://",
	"svn://",
	"tel:",
	"telnet://",
	"urn:",
	"worldwind://",
	"xmpp:",
}
-- Convert into lookup table.
local uri_lookup = {}
for _, scheme in ipairs(uri_schemes) do
	uri_lookup[scheme] = encode(scheme, ":")
end
data.uri_schemes = uri_lookup

return data