Content deleted Content added
expand accents, add to remove |
fix replace order, add accented characters |
||
Line 93:
"PROVINCE OF","PROVINCE","TERRITORY","COUNTY","CITY OF"
}
local patterns = {
"%..*","^THE ","%_","%-","%d%d?%d?PX"
}
local replacements = {["(%a)%.(%a)%."]="%1%2", -- Replacements for patterns above (order does not matter)
[".+:"]="",["|.+"]="",["%(.-%)"]="",
["%..*"]="",["^THE "]="",["%_"]=" ",["%-"]=" ",
["%d%d?%d?PX"]="",
Line 103 ⟶ 107:
text = mw.ustring.gsub(text,"[À-Ż]",accents) -- Deaccent
for
local value = replacements[pattern]
end
Line 113 ⟶ 118:
text = mw.ustring.gsub(text,"%W","") -- Remove non alpha-numeric
return mw.text.trim(text)
end
|