Open main menu

This module is not to be directly used. It is used by {{la-IPA}}, see there for usage.


local export = {}

local m_a = require("Module:accent qualifier")
local m_IPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("la")

local u = mw.ustring.char
local rfind = mw.ustring.find
local rsubn = mw.ustring.gsub
local rmatch = mw.ustring.match
local rsplit = mw.text.split
local ulower = mw.ustring.lower
local usub = mw.ustring.sub
local ulen = mw.ustring.len

local BREVE = u(0x0306) -- breve =  ̆

local letters_ipa = {
	["a"] = "a",["e"] = "e",["i"] = "i",["o"] = "o",["u"] = "u",["y"] = "y",
	["ā"] = "aː",["ē"] = "eː",["ī"] = "iː",["ō"] = "oː",["ū"] = "uː",["ȳ"] = "yː",
	["ae"] = "ae̯",["oe"] = "oe̯",["ei"] = "ei̯",["au"] = "au̯",["eu"] = "eu̯",
	["b"] = "b",["d"] = "d",["f"] = "f",
	["c"] = "k",["g"] = "ɡ",["v"] = "w",["x"] = "ks",
	["ph"] = "pʰ",["th"] = "tʰ",["ch"] = "kʰ",["gh"] = "ɡʰ",["rh"] = "r",["qv"] = "kʷ",["gv"] = "ɡʷ",
	["'"] = "ˈ",["ˈ"] = "ˈ",
}

local letters_ipa_eccl = {
	["a"] = "a",["e"] = "e",["i"] = "i",["o"] = "o",["u"] = "u",["y"] = "i",
	["ā"] = "aː",["ē"] = "eː",["ī"] = "iː",["ō"] = "oː",["ū"] = "uː",["ȳ"] = "iː",
	["ae"] = "ɛː",["oe"] = "ɛː",["ei"] = "ei̯",["au"] = "au̯",["eu"] = "eu̯",
	["b"] = "b",["d"] = "d",["f"] = "f",
	["c"] = "k",["g"] = "ɡ",["v"] = "v",["x"] = "ks",
	["ph"] = "f",["th"] = "tʰ",["ch"] = "kʰ",["gh"] = "ɡʰ",["rh"] = "r",["qv"] = "kw",["gv"] = "ɡw",
	["h"] = "",
	["'"] = "ˈ",["ˈ"] = "ˈ",
}

local letters_ipa_vul = {
	["a"] = "a",["e"] = "ɛ",["i"] = "i",["o"] = "ɔ",["u"] = "u",["y"] = "e",
	["ā"] = "aː",["ē"] = "eː",["ī"] = "iː",["ō"] = "oː",["ū"] = "uː",["ȳ"] = "eː",
	["ae"] = "e",["oe"] = "e",["ei"] = "ei̯",["au"] = "au̯",["eu"] = "eu̯",
	["b"] = "β",["d"] = "d",["f"] = "f",
	["c"] = "k",["g"] = "ɡ",["v"] = "β",["x"] = "s",
	["ph"] = "f",["th"] = "tʰ",["ch"] = "kʰ",["gh"] = "g",["rh"] = "r",["qv"] = "kʷ",["gv"] = "ɡʷ",
	["h"] = "",
	["'"] = "ˈ",["ˈ"] = "ˈ",
}

local phonetic_vowels = {
	["e"] = "ɛ",
	["i"] = "ɪ",
	["o"] = "ɔ",
	["u"] = "ʊ",
	["y"] = "ʏ",
}

local phonetic_rules = {
	-- Velar nasal assimilation
	{"ɡ([.ˈ]?)n", "ŋ%1n"},
	{"n([.ˈ]?)([kɡ])", "ŋ%1%2"},
	
	-- Fronted labialization before front vowels
	{"ʷ([eɛiɪyʏ])", "ᶣ%1"},
	
	-- Tensing of vowels before another vowel
	{"ɛ([.ˈ]?)([aeɛiɪoɔuʊyʏ])", "e%1%2"},
	{"ɪ([.ˈ]?)([aeɛiɪoɔuʊyʏ])", "i%1%2"},
	
	-- Nasal vowels
	{"a[m]$", "ãː"},
	{"[eɛ][m]$", "ẽː"},
	{"[iɪ][m]$", "ĩː"},
	{"[oɔ][m]$", "õː"},
	{"[uʊ][m]$", "ũː"},
	{"[yʏ][m]$", "ỹː"},
	{"a[nm]([.ˈ]?[sf])", "ãː%1"},
	{"[eɛ][nm]([.ˈ]?[sf])", "ẽː%1"},
	{"[iɪ][nm]([.ˈ]?[sf])", "ĩː%1"},
	{"[oɔ][nm]([.ˈ]?[sf])", "õː%1"},
	{"[uʊ][nm]([.ˈ]?[sf])", "ũː%1"},
	{"[yʏ][nm]([.ˈ]?[sf])", "ỹː%1"},
	
	--L pinguis
	{"l", "ɫ"},
	{"ɫ([.ˈ]?)ɫ", "l%1l"},
	{"ɫ([.ˈ]?[iɪyʏ])", "l%1"},
}

local phonetic_rules_eccl = {
	{"n([.ˈ]?)([kɡ])", "ŋ%1%2"}, --assimilation
	{"z", "d͡z"},
	{"([aɛeiɔou])ː?%.([ʃɲ])([aɛeiɔou])","%1%2.%2%3"}, --gemination
}

local lenition = {
	["ɡ"] = "ɣ", ["g"] = "ɣ", ["d"] = "ð", ["k"] = "ɡ", ["t"] = "d", ["p"] = "b",
}

local phonetic_rules_vul = {
	{"β([.ˈ])β","b%1b"},
	{"[ɛei]%.([aɔo])","ʲ%1"},
	{"[ɛei]%.u([^:])","ʲu%1"},
	{"[.ˈ]([^.ˈ]*)[ɛei]ˈ([aɔo])","ˈ%1ʲ%2"},
	{"([^.ˈ]*)[ɛei]ˈ([aɔo])","ˈ%1ʲ%2"},
	{"([tk])([ɛei])","%1ʲ%2"},
	{"u%.([aɛeiɔo])","ʷ%1"},
	{"[.ˈ]([^.ˈ]*)u%.([aɛeiɔo])","ˈ%1ʷ%2"},
	{"([^.ˈ]*)u%.([aɛeiɔo])","ˈ%1ʷ%2"},
	{"i([^ː])", "e%1"},
	{"u([^ː])", "o%1"},
	{"βʲ","βj"},
	{"^(ˈ?)β","%1b"},
	{"([aɛeiɔouː][.ˈ])([ɡdktp])([aɛeiɔou])", function (before, consonant, after)
		return before .. lenition[consonant] .. after
	end},
	{"a[nm]$", "ã"},
	{"[eɛ][nm]$", "ẽ"},
	{"i[nm]$", "ĩ"},
	{"[oɔ][nm]$", "õ"},
	{"u[nm]$", "ũ"},
	{"ː",""},
}

local lengthen_vowel = {
	["a"] = "aː", ["aː"] = "aː",
	["ɛ"] = "ɛː", ["ɛː"] = "ɛː",
	["e"] = "eː", ["eː"] = "eː",
	["i"] = "iː", ["iː"] = "iː",
	["ɔ"] = "ɔː", ["ɔː"] = "ɔː",
	["o"] = "oː", ["oː"] = "oː",
	["u"] = "uː", ["uː"] = "uː",
}

local vowels = {
	"a", "ɛ", "e", "ɪ", "i", "ɔ", "o", "ʊ", "u", "y",
	"aː", "ɛː", "eː", "iː", "ɔː", "oː", "uː", "yː",
	"ae̯", "oe̯", "ei̯", "au̯", "eu̯",
}


local onsets = {
	"b", "p", "pʰ", "d", "t", "tʰ", "β",
	"ɡ", "gʰ", "k", "kʰ", "kʷ", "ɡʷ", "kw", "ɡw", "t͡s", "t͡ʃ", "d͡ʒ", "ʃ",
	"f", "s", "h", "z",
	"l", "m", "n", "ɲ", "r", "j", "v", "w",
	
	"bl", "pl", "pʰl", "br", "pr", "pʰr", "ps", 
	"dr", "tr", "tʰr",
	"ɡl", "kl", "kʰl", "ɡr", "kr", "kʰr",
	"fl", "fr",
	
	"sp", "st", "sk", "skʷ", "sl", "sm", "sn", "sw",
	"spr", "str", "skr",
	"spl", "skl",
}

local codas = {
	"b", "p", "pʰ", "d", "t", "tʰ", "ɡ", "k", "kʰ", "β",
	"f", "s",
	"l", "m", "n", "ɲ", "r", "j", "ʃ",
	
	"sp", "st", "sk",
	"spʰ", "stʰ", "skʰ",
	
	"lp", "lt", "lk",
	"lb", "ld", "lɡ",
	"lpʰ", "ltʰ", "lkʰ",
	"lf",
	
	"rp", "rt", "rk",
	"rb", "rd", "rɡ",
	"rpʰ", "rtʰ", "rkʰ",
	"rf",
	
	"mp", "nt", "nk",
	"mb", "nd", "nɡ",
	"mpʰ", "ntʰ", "nkʰ",
	
	"lm", "rl", "rm", "rn",
	
	"ps", "ts", "ks", "ls", "ns", "rs",
	"lks", "nks", "rks",
	"lms", "rls", "rms", "rns",
}

local remove_macrons = {
	["ā"] = "a",
	["ē"] = "e",
	["ī"] = "i",
	["ō"] = "o",
	["ū"] = "u",
	["ȳ"] = "y",
}

local macrons_to_breves = {
	["ā"] = "ă",
	["ē"] = "ĕ",
	["ī"] = "ĭ",
	["ō"] = "ŏ",
	["ū"] = "ŭ",
	-- Unicode doesn't have breve-y
	["ȳ"] = "y" .. BREVE,
}

local remove_breves = {
	["ă"] = "a",
	["ĕ"] = "e",
	["ĭ"] = "i",
	["ŏ"] = "o",
	["ŭ"] = "u",
	-- Unicode doesn't have breve-y
}

local remove_ligatures = {
	["æ"] = "ae",
	["œ"] = "oe",
}

for i, val in ipairs(vowels) do
	vowels[val] = true
end

for i, val in ipairs(onsets) do
	onsets[val] = true
end

for i, val in ipairs(codas) do
	codas[val] = true
end

local vowels_string = "aeiouyāēīōūȳăĕĭŏŭ" -- no breve-y in Unicode
local vowels_c = "[" .. vowels_string .. "]"
local non_vowels_c = "[^" .. vowels_string .. "]"

-- version of rsubn() that discards all but the first return value
local function rsub(term, foo, bar)
	local retval = rsubn(term, foo, bar)
	return retval
end


local function letters_to_ipa(word,phonetic,eccl,vul)
	local phonemes = {}
	
	local dictionary = eccl and letters_ipa_eccl or (vul and letters_ipa_vul or letters_ipa)
	
	while ulen(word) > 0 do
		local longestmatch = ""
		
		for letter, ipa in pairs(dictionary) do
			if ulen(letter) > ulen(longestmatch) and usub(word, 1, ulen(letter)) == letter then
				longestmatch = letter
			end
		end
		
		if ulen(longestmatch) > 0 then
			if dictionary[longestmatch] == "ks" then
				table.insert(phonemes, "k")
				table.insert(phonemes, "s")
			else
				table.insert(phonemes, dictionary[longestmatch])
			end
			word = usub(word, ulen(longestmatch) + 1)
		else
			table.insert(phonemes, usub(word, 1, 1))
			word = usub(word, 2)
		end
	end
	
	if eccl then for i=1,#phonemes do
		if phonemes[i+1] and (phonemes[i] == "k" or phonemes[i] == "ɡ") and (phonemes[i+1] == "e" or phonemes[i+1] == "ɛ" or phonemes[i+1] == "eː" or phonemes[i+1] == "i" or phonemes[i+1] == "iː") then
			phonemes[i] = phonemes[i] == "k" and "t͡ʃ" or "d͡ʒ"
			if phonemes[i] == "t͡ʃ" and phonemes[i-1] == "s" and not (phonemes[i-2] and not vowels[phonemes[i-2]]) and not (phonemes[i+1] and not vowels[phonemes[i+1]]) then
				phonemes[i-1] = "ʃ"
				phonemes[i] = "ʃ"
			end
			if phonemes[i-1] == "k" and phonemes[i] == "t͡ʃ" then
				phonemes[i-1] = "t"
			end
			if phonemes[i-1] == "g" and phonemes[i] == "d͡ʒ" then
				phonemes[i-1] = "d"
			end
		end
		if phonemes[i+2] and phonemes[i] == "t" and phonemes[i+1] == "i" and vowels[phonemes[i+2]] and phonemes[i-1] ~= "s" then
			phonemes[i] = "t͡s"
		end
		if phonemes[i] == "kʰ" then phonemes[i] = "k" end
		if phonemes[i] == "tʰ" then phonemes[i] = "t" end
		if phonemes[i+1] and phonemes[i] == "ɡ" and phonemes[i+1] == "n" then
			phonemes[i] = "ɲ"
			phonemes[i+1] = "ɲ"
		end
	end end
	
	return phonemes
end


local function get_onset(syll)
	local consonants = {}
	
	for i = 1, #syll do
		if vowels[syll[i]] then
			break
		end
		if syll[i] ~= "ˈ" then
			table.insert(consonants, syll[i])
		end
	end
	
	return table.concat(consonants)
end


local function get_coda(syll)
	local consonants = {}
	
	for i = #syll, 1, -1 do
		if vowels[syll[i]] then
			break
		end
		
		table.insert(consonants, 1, syll[i])
	end
	
	return table.concat(consonants)
end


local function get_vowel(syll)
	for i = 1,#syll do
		if vowels[syll[i]] then return syll[i] end
	end
end


-- Split the word into syllables of CV shape
local function split_syllables(remainder)
	local syllables = {}
	local syll = {}
	
	for _, phoneme in ipairs(remainder) do
		if phoneme == "." then
			if #syll > 0 then
				table.insert(syllables, syll)
				syll = {}
			end
		elseif phoneme == "ˈ" then
			if #syll > 0 then
				table.insert(syllables,syll)
			end
			syll = {"ˈ"}
		elseif vowels[phoneme] then
			table.insert(syll, phoneme)
			table.insert(syllables, syll)
			syll = {}
		else
			table.insert(syll, phoneme)
		end
	end
	
	-- If there are phonemes left, then the word ends in a consonant
	-- Add them to the last syllable
	for _, phoneme in ipairs(syll) do
		table.insert(syllables[#syllables], phoneme)
	end
	
	-- Split consonant clusters between syllables
	for i, current in ipairs(syllables) do
		if i > 1 then
			local previous = syllables[i-1]
			local onset = get_onset(current)
			-- Shift over consonants until the syllable onset is valid
			while not (onset == "" or onsets[onset]) do
				table.insert(previous, table.remove(current, 1))
				onset = get_onset(current)
			end
			
			-- If the preceding syllable still ends with a vowel, and the current one begins with s + another consonant, or with gn, then shift it over
			if get_coda(previous) == "" and ((current[1] == "s" and not vowels[current[2]]) or (current[1] =="g" and current[2] == "n")) then
				table.insert(previous, table.remove(current, 1))
			end
			
			-- If there is no vowel at all in this syllable
			if not get_vowel(current) then
				for j=1,#current do
					table.insert(syllables[i-1], table.remove(current, 1))
				end
				table.remove(syllables,i)
			end
			
		end
	end
	
	for i, syll in ipairs(syllables) do
		local onset = get_onset(syll)
		local coda = get_coda(syll)
		
		if not (onset == "" or onsets[onset]) then
			require("Module:debug").track("la-pronunc/bad onset")
			--error("onset error:[" .. onset .. "]")
		end
		
		if not (coda == "" or codas[coda]) then
			require("Module:debug").track("la-pronunc/bad coda")
			--error("coda error:[" .. coda .. "]")
		end
	end
	
	return syllables
end


local function detect_accent(syllables,eccl)
	-- Manual override
	for i=1,#syllables do
		for j=1,#syllables[i] do
			if syllables[i][j] == "ˈ" then
				table.remove(syllables[i],j)
				return i
			end
		end
	end
	-- Detect accent placement
	if #syllables > 2 then
		-- Does the penultimate syllable end in a single vowel?
		local penult = syllables[#syllables-1]
		
		if rfind(penult[#penult], "^[aɛeiɔouy]$") then
			return #syllables - 2
		else
			return #syllables - 1
		end
	elseif #syllables == 2 then
		return #syllables - 1
	end
end


local function convert_word(word, phonetic, eccl, vul)
	-- Normalize i/j/u/v; do this before removing breves, so we keep the
	-- ŭ in langŭī (perfect of languēscō) as a vowel.
	word = rsub(word, "w", "v")
	word = rsub(word, "(" .. vowels_c .. ")v(" .. non_vowels_c .. ")", "%1u%2")
	word = rsub(word, "qu", "qv")
	word = rsub(word, "ngu(" .. vowels_c .. ")", "ngv%1")
	
	word = rsub(word, "^i(" .. vowels_c .. ")", "j%1")
	word = rsub(word, "^u(" .. vowels_c .. ")", "v%1")
	word = rsub(word, "(" .. vowels_c .. ")i(" .. vowels_c .. ")", "%1jj%2")
	word = rsub(word, "(" .. vowels_c .. ")u(" .. vowels_c .. ")", "%1v%2")

	-- Now remove breves.
	word = rsub(word, "([ăĕĭŏŭ])", remove_breves)
	-- BREVE sits uncombined in y+breve and vowel-macron + breve
	word = rsub(word, BREVE, "")
	
	-- Normalize aë, oë; do this after removing breves but before any
	-- other normalizations involving e.
	word = rsub(word, "([ao])ë", "%1.e")

	-- Eu and ei diphthongs
	word = rsub(word, "e(u[ms])$", "e.%1")
	word = rsub(word, "ei", "e.i")
	word = rsub(word, "_", "")
	
	-- Vowel length before nasal + fricative is allophonic
	word = rsub(word, "([āēīōūȳ])([mn][fs])",
		function(vowel, nasalfric)
			return remove_macrons[vowel] .. nasalfric
		end
	)
	
	-- Apply some basic phoneme-level assimilations
	word = rsub(word, "xs?", "x")
	word = rsub(word, "b([st])", "p%1")
	word = rsub(word, "d([st])", "t%1")
	word = rsub(word, "g([st])", "k%1")
	word = rsub(word, "n([bp])", "m%1")

	-- Per May 10 2019 discussion in [[Module talk:la-pronunc]], we syllabify
	-- prefixes ab-, ad-, ob-, sub- separately from following l or r.
	word = rsub(word, "^a([bd])([lr])", "a%1.%2")	
	word = rsub(word, "^ob([lr])", "ob.%1")	
	word = rsub(word, "^sub([lr])", "sub.%1")	

	-- Convert word to IPA
	local phonemes = letters_to_ipa(word,phonetic,eccl,vul)
	
	-- Split into syllables
	local syllables = split_syllables(phonemes)
	
	-- Add accent
	local accent = detect_accent(syllables,eccl)
	
	for i, syll in ipairs(syllables) do
		for j, phoneme in ipairs(syll) do
			if eccl then
				syll[j] = rsub(syll[j], "ː", "")
			elseif phonetic and not vul then
				syll[j] = phonetic_vowels[syll[j]] or syll[j]
			end
		end
	end
	
	for i, syll in ipairs(syllables) do
		if eccl and i == accent and phonetic and vowels[syll[#syll]] then
			syll[#syll] = lengthen_vowel[syll[#syll]] or syll[#syll]
		end
		
		for j=1, #syll-1 do
			if syll[j]==syll[j+1] then
				syll[j+1] = ""
			end
		end
	end
	
	for i, syll in ipairs(syllables) do
		syll = table.concat(syll)
		if vul and i ~= accent then
			syll = rsub(syll,"ɔ","o")
			syll = rsub(syll,"ɛ","e")
		end
		syllables[i] = (i == accent and "ˈ" or "") .. syll
	end
	
	word = (rsub(table.concat(syllables, "."), "%.ˈ", "ˈ"))
	
	if phonetic then
		local rules = eccl and phonetic_rules_eccl or (vul and phonetic_rules_vul or phonetic_rules)
		for i, rule in ipairs(rules) do
			word = rsub(word, rule[1], rule[2])
		end
	end
	
	if eccl and not phonetic then
		word = rsub(word,"ɔ","o")
		word = rsub(word,"ʃ%.ʃ",".ʃ")
		word = rsub(word,"ʃˈʃ","ˈʃ")
		word = rsub(word,"ɲ%.ɲ",".ɲ")
		word = rsub(word,"ɲˈɲ","ˈɲ")
	end
	
	return word
end

function initial_canonicalize_text(text)
	-- Call ulower() even though it's also called in phoneticize,
	-- in case convert_words() is called externally.
	text = ulower(text)
	text = rsub(text, '[,?!:;()"%-]', '')
	text = rsub(text, '[æœ]', remove_ligatures)
	return text
end

function export.convert_words(text, phonetic, eccl, vul)
	text = initial_canonicalize_text(text)
	
	local disallowed = rsub(text, '[a-zāēīōūȳăĕĭŏŭë,.?!:;()\'"_ ' .. BREVE .. ']', '')
	if ulen(disallowed) > 0 then
		if ulen(disallowed) == 1 then
			error('The character "' .. disallowed .. '" is not allowed.')
		else
			error('The characters "' .. disallowed .. '" are not allowed.')
		end	
	end
	
	local result = {}
	
	for word in mw.text.gsplit(text, " ") do
		table.insert(result, convert_word(word, phonetic, eccl, vul))
	end
	
	return table.concat(result, " ")
end

-- Phoneticize Latin TEXT. Return a list of one or more phoneticizations,
-- each of which is a two-element list {PHONEMIC, PHONETIC}. If ECCL, use
-- Ecclesiastical pronunciation. If VUL, use Vulgar Latin pronunciation.
-- Otherwise, use Classical pronunciation.
function export.phoneticize(text, eccl, vul)
	local function do_phoneticize(text, eccl, vul)
		return {
			export.convert_words(text, false, eccl, vul),
			export.convert_words(text, true, eccl, vul),
		}
	end

	text = ulower(text)
	if rfind(text, "[āēīōūȳ]" .. BREVE) then
		local longvar = rsub(text, "([āēīōūȳ])" .. BREVE, "%1")
		local shortvar = rsub(text, "([āēīōūȳ])" .. BREVE, macrons_to_breves)
		local longipa = do_phoneticize(longvar, eccl, vul)
		local shortipa = do_phoneticize(shortvar, eccl, vul)
		return {longipa, shortipa}
	else
		return {do_phoneticize(text, eccl, vul)}
	end
end

local function make_row(phoneticizations, dial)
	local full_pronuns = {}
	for _, phoneticization in ipairs(phoneticizations) do
		local phonemic = phoneticization[1]
		local phonetic = phoneticization[2]
		local IPA_args = {{pron = '/' .. phonemic .. '/'}}
		if phonemic ~= phonetic then
			table.insert(IPA_args, {pron = '[' .. phonetic .. ']'})
		end
		table.insert(full_pronuns, m_IPA.format_IPA_full(lang, IPA_args))
	end
	return m_a.show({dial}) .. ' ' .. table.concat(full_pronuns, ' or ')
end

function export.show_full(frame)
	local params = {
		[1] = {default = mw.title.getCurrentTitle().nsText == 'Template' and 'īnspīrāre' or mw.title.getCurrentTitle().text},
		classical = {type = 'boolean', default = true},
		eccl = {type = 'boolean'},
		vul = {type = 'boolean', default = mw.title.getCurrentTitle().nsText == 'Reconstruction'},
	}
	local args = require("Module:parameters").process(frame:getParent().args, params)
	text = args[1]
	local categories = {}
	
	local out = ''
	
	if args.classical then
		out = make_row(export.phoneticize(text, false, false), 'Classical')
	end
	
	if args.eccl then
		out = out .. '\n* ' .. make_row(
			export.phoneticize(text, true, false),
			'Ecclesiastical'
		)
		table.insert(categories, lang:getCanonicalName() .. ' terms with Ecclesiastical IPA pronunciation')
	end

	if args.vul then
		out = out .. '\n* ' .. make_row(
			export.phoneticize(text, false, true),
			'Vulgar'
		)
	end
	
	export.track(text)
	
	return out .. require("Module:utilities").format_categories(categories)
end


function export.show(text, phonetic, eccl, vul)
	if type(text) == "table" then -- assume a frame
		eccl = text.args["eccl"]
		vul = text.args["vul"]
		text = text.args[1] or mw.title.getCurrentTitle().text
	end
	
	if vul then
		phonetic = true
	end
	
	return export.convert_words(text, phonetic, eccl, vul)
end


function export.allophone(word, eccl, vul)
	return export.show(word, true, eccl, vul)
end


-- FIXME: Remove this tracking code.
local unassimilated_prefixes = {
	'ab', 'ad', 'circum', 'con', 'contrā', 'dis', 'ex', 'īn', 'inter', 'ob',
	'per', 'sub', 'subter'
}


-- FIXME: Remove this tracking code.
function export.track(text)
	if type(text) == "table" then -- assume a frame
		text = text.args[1] or mw.title.getCurrentTitle().text
	end
	text = initial_canonicalize_text(text)
	text = rsub(text, "[.']", '')
	
	temp = text
	repeat
		text = temp
		for _, prefix in ipairs(unassimilated_prefixes) do
			temp = rsub(temp, "^" .. prefix, "")
		end
	until temp == text
	
	if rfind(text,'^i[aeiouyāēīōūȳ]') then
		return "[[Category:Kenny's testing category 8]]"
	end
end

return export

-- For Vim, so we get 4-space tabs
-- vim: set ts=4 sw=4 noet: