Модуль:transcription-grc

Материал из Викисловаря
Документация
local export = {}

local periods = {'cla', 'koi1', 'koi2', 'byz1', 'byz2'}
local inlinePeriods = {'cla', 'koi2', 'byz2'}
local IPAs = {}

local periodLabels = {['cla']="'''Аттическое произношение'''",
	['koi1'] = 'Египетское произношение',
	['koi2'] = "'''Койне'''",
	['byz1'] = 'Византийское произношение',
	['byz2'] = "'''Константинопольское произношение'''",
	}


local d1 = '͜'   
local d2 = '́'  
local d3 = '̀'  
local d4 = '᷄'  
local d5 = '᷆'  
local d6 = '᷇'  
local d7 = '̆'  

local l = {
	[''] = {['end']=true},
	[' '] = {['p'] = {['cla'] = ' '}},
	['β'] = {['type'] = 'consonant', ['labial'] = true, ['stop'] = true, ['voiced']=true, ['clusters']={['δ']=true, ['λ']=true, ['ρ']=true}, 
		['p'] = {['cla']='b', ['koi1']='b', ['koi2']='β', ['byz1']='v', ['byz2']={{'1=β', ''}, {'-1=μ', 'b'}, 'v'}}},
	['γ'] = {['type'] = 'consonant', ['dorsal'] = true, ['stop'] = true, ['voiced']=true, ['clusters']={['λ']=true, ['ν']=true, ['ρ']=true}, 
		['p'] = {['cla']={{'1.dorsal', 'ŋ'}, 'ɡ'}, ['koi1']={{'1.dorsal', 'ŋ'}, 'ɡ'}, 
			['koi2']={{'1.dorsal', 'ŋ'}, 'ɣ'}, 
			['byz1']={{'1.dorsal', {{'1-preFront', 'ɲ'}, 'ŋ'}}, {'0-preFront', {{'-1=γ', 'ɟ'}, 'ʝ'}}, 'ɣ'},
			['byz2']={{'1.dorsal', {{'1-preFront', 'ɲ'}, 'ŋ'}}, {'0-preFront', {{'-1=γ', 'ɟ'}, 'ʝ'}}, 'ɣ'}}},
	['δ'] = {['type'] = 'consonant', ['place']='coronal', ['stop']=true, ['voiced']=true, ['clusters']={['ρ']=true}, 
		['p'] = {['cla']='d', ['koi1']='d', ['koi2']='ð', ['byz1']='ð', ['byz2']={{'1=δ', ''}, {'-1=ν', 'd'}, 'ð'}}},
	['ζ'] = {['type'] = 'consonant', ['place']='coronal', ['fricative']=true, ['voiced']=true, ['clusters']={}, 
		['p'] = {['cla']='zd', ['koi1']='z', ['koi2']='z', ['byz1']='z', ['byz2']='z'}},
	['θ'] = {['type'] = 'consonant', ['place']='coronal', ['stop']=true, ['unvoiced']=true, ['aspirate']=true, ['clusters']={['ρ']=true}, 
		['p'] = {['cla']='tʰ', ['koi1']='tʰ', ['koi2']='θ', ['byz1']='θ', ['byz2']={{'1=θ', ''}, 'θ'}}},
	['κ'] = {['type'] = 'consonant', ['place']='dorsal', ['stop']=true, ['unvoiced']=true, ['clusters']={['λ']=true, ['ν']=true, ['τ']=true, ['ρ']=true}, 
		['p'] = {['cla']={{'1.voiced+1.stop', 'ɡ'}, 'k'}, 
			['koi1']={{'1.voiced+1.stop', 'ɡ'}, 'k'}, 
			['koi2']={{'1.voiced+1.stop', 'ɡ'}, 'k'}, 
			['byz1']={{'1=κ', ''}, {'1.voiced+1.stop', 'ɡ'}, {'0-preFront', 'c'}, 'k'},
			['byz2']={{'1=κ', ''}, {'1.voiced+1.stop', 'ɡ'}, {'0-preFront', 'c'}, 'k'}}},
	['λ'] = {['type'] = 'consonant', ['place']='coronal', ['approximant']=true, ['voiced']=true, ['clusters']={}, 
		['p'] = {['cla']='l', ['koi1']='l', ['koi2']='l', ['byz1']='l', ['byz2']={{'1=λ', ''}, 'l'}}},
	['μ'] = {['type'] = 'consonant', ['place']='labial', ['nasal']=true, ['voiced']=true, ['clusters']={['ν']=true}, 
		['p'] = {['cla']='m', ['koi1']='m', ['koi2']='m', ['byz1']='m', ['byz2']={{'1=μ/1=β', ''}, 'm'}}},
	['ν'] = {['type'] = 'consonant', ['place']='coronal', ['nasal']=true, ['voiced']=true, ['clusters']={}, 
		['p'] = {['cla']='n', ['koi1']='n', ['koi2']='n', ['byz1']='n', ['byz2']={{'1=ν/1=δ', ''}, 'n'}}},
	['ξ'] = {['type'] = 'consonant', ['place']='dorsal', ['stop']=true, ['unvoiced']=true, ['sibilate']=true, ['clusters']={}, 
		['p'] = {['cla']='kʰs', ['koi1']='kʰs', ['koi2']='xs', ['byz1']='ks', ['byz2']='ks'}},
	['π'] = {['type'] = 'consonant', ['place']='labial', ['stop']=true, ['unvoiced']=true, ['clusters']={['λ']=true, ['ν']=true, ['ρ']=true, ['τ']=true}, 
		['p'] = {['cla']='p', ['koi1']='p', ['koi2']='p', ['byz1']='p', ['byz2']={{'1=π', ''}, 'p'}}},
	['ρ'] = {['type'] = 'consonant', ['place']='coronal', ['trill']=true, ['voiced']=true, ['clusters']={}, 
		['p'] = {['cla']={{'1=ρ/1=ῥ/-1=ρ', 'r̥'}, 'r'}, ['koi1']={{'1=ρ/1=ῥ/-1=ρ', 'r̥'}, 'r'}, ['koi2']='r', ['byz1']='r', ['byz2']={{'1=ρ', ''}, 'r'}}},
	['ῥ'] = {['type'] = 'consonant', ['place']='coronal', ['trill']=true, ['voiced']=false, ['clusters']={}, 
		['p'] = {['cla']='r̥', ['koi1']='r̥', ['koi2']='r', ['byz1']='r', ['byz2']={{'1=ρ', ''}, 'r'}}},
	['σ'] = {['type'] = 'consonant', ['place']='coronal', ['fricative']=true, ['unvoiced']=true, ['clusters']={['β']=true, ['θ']=true, ['κ']=true, ['μ']=true, ['π']=true, ['τ']=true, ['φ']=true, ['χ']=true, }, 
		['p'] = {['cla']='s', ['koi1']='s', ['koi2']='s', ['byz1']='s', ['byz2']={{'1=σ', ''}, 's'}}},
	['τ'] = {['type'] = 'consonant', ['place']='coronal', ['stop']=true, ['unvoiced']=true, ['clusters']={['λ']=true, ['μ']=true, ['ρ']=true}, 
		['p'] = {['cla']='t', ['koi1']='t', ['koi2']='t', ['byz1']='t', ['byz2']={{'1=τ', ''}, 't'}}},
	['φ'] = {['type'] = 'consonant', ['place']='labial', ['stop']=true, ['unvoiced']=true, ['clusters']={['θ']=true, ['λ']=true, ['ρ']=true}, 
		['p'] = {['cla']='pʰ', ['koi1']='pʰ', ['koi2']='ɸ', ['byz1']='f', ['byz2']={{'1=φ', ''}, 'f'}}},
	['χ'] = {['type'] = 'consonant', ['dorsal']=true, ['stop']=true, ['unvoiced']=true, ['aspirate']=true, ['clusters']={['θ']=true, ['λ']=true, ['ρ']=true}, 
		['p'] = {['cla']='kʰ', ['koi1']='kʰ', ['koi2']='x', 
			['byz1']={{'1=χ', ''}, {'0-preFront', 'ç'}, 'x'},
			['byz2']={{'1=χ', ''}, {'0-preFront', 'ç'}, 'x'}}},
	['ψ'] = {['type'] = 'consonant', ['place']='labial', ['stop']=true, ['unvoiced']=true, ['sibilate']=true, ['clusters']={}, 
		['p'] = {['cla']='pʰs', ['koi1']='pʰs', ['koi2']='ɸs', ['byz1']='ps', ['byz2']='ps'}},
	['ϝ'] = {['type'] = 'consonant', ['place']='labial', ['approximant']=true, ['voiced']=true, ['clusters']={},
		['p'] = {['cla']='w', ['koi1']='', ['koi2']='', ['byz1']='', ['byz2']=''}},
	['α'] = {['type'] = 'vowel', ['length']='either', 
		['p'] = {['cla']='a', ['koi1']='a', ['koi2']='a', ['byz1']='a', ['byz2']='a'}},
	['ε'] = {['type'] = 'vowel', ['length']='short', 
		['p'] = {['cla']='e', ['koi1']='ɛ', ['koi2']='e', ['byz1']='e', ['byz2']='e'}},
	['η'] = {['type'] = 'vowel', ['length']='long', 
		['p'] = {['cla']='ɛ', ['koi1']='e', ['koi2']='i', ['byz1']='i', ['byz2']='i'}},
	['ι'] = {['type'] = 'vowel', ['length']='either', 
		['p'] = {['cla']='i', ['koi1']='i', ['koi2']='i', ['byz1']='i', ['byz2']='i'}},
	['ο'] = {['type'] = 'vowel', ['length']='short', 
		['p'] = {['cla']='o', ['koi1']='o', ['koi2']='o', ['byz1']='o', ['byz2']='o'}},
	['υ'] = {['type'] = 'vowel', ['length']='either', 
		['p'] = {['cla']='y', ['koi1']='y', ['koi2']='y', ['byz1']='y', ['byz2']='i'}},
	['ω'] = {['type'] = 'vowel', ['length']='long', 
		['p'] = {['cla']='ɔ', ['koi1']='o', ['koi2']='o', ['byz1']='o', ['byz2']='o'}},
	['ϊ'] = {['type'] = 'vowel', ['naked']='ι', ['diar']=true},
	['ϋ'] = {['type'] = 'vowel', ['naked']='υ', ['diar']=true},
	['ἀ'] = {['type'] = 'vowel', ['naked']='α', ['breath']='smooth'},	
	['ἐ'] = {['type'] = 'vowel', ['naked']='ε', ['breath']='smooth'},	
	['ἠ'] = {['type'] = 'vowel', ['naked']='η', ['breath']='smooth'},
	['ἰ'] = {['type'] = 'vowel', ['naked']='ι', ['breath']='smooth'},	
	['ὀ'] = {['type'] = 'vowel', ['naked']='ο', ['breath']='smooth'},
	['ὐ'] = {['type'] = 'vowel', ['naked']='υ', ['breath']='smooth'},
	['ὠ'] = {['type'] = 'vowel', ['naked']='ω', ['breath']='smooth'},
	['ὰ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='grave'},
	['ᾀ'] = {['type'] = 'vowel', ['naked']='α', ['breath']='smooth', ['subi']=true},
	['ᾐ'] = {['type'] = 'vowel', ['naked']='η', ['breath']='smooth', ['subi']=true},
	['ᾠ'] = {['type'] = 'vowel', ['naked']='ω', ['breath']='smooth', ['subi']=true},
	['ᾰ'] = {['type'] = 'vowel', ['naked']='α', ['length']='short'},
	['ῐ'] = {['type'] = 'vowel', ['naked']='ι', ['length']='short'},
	['ῠ'] = {['type'] = 'vowel', ['naked']='υ', ['length']='short'},
	['ἁ'] = {['type'] = 'vowel', ['naked']='α', ['breath']='rough'},
	['ἑ'] = {['type'] = 'vowel', ['naked']='ε', ['breath']='rough'},
	['ἡ'] = {['type'] = 'vowel', ['naked']='η', ['breath']='rough'},
	['ἱ'] = {['type'] = 'vowel', ['naked']='ι', ['breath']='rough'},
	['ὁ'] = {['type'] = 'vowel', ['naked']='ο', ['breath']='rough'},
	['ὑ'] = {['type'] = 'vowel', ['naked']='υ', ['breath']='rough'},
	['ὡ'] = {['type'] = 'vowel', ['naked']='ω', ['breath']='rough'},	
	['ά'] = {['type'] = 'vowel', ['naked']='α', ['accent']='acute'},	
	['ᾁ'] = {['type'] = 'vowel', ['naked']='α', ['breath']='rough', ['subi']=true},
	['ᾑ'] = {['type'] = 'vowel', ['naked']='η', ['breath']='rough', ['subi']=true},
	['ᾡ'] = {['type'] = 'vowel', ['naked']='ω', ['breath']='rough', ['subi']=true},	
	['ᾱ'] = {['type'] = 'vowel', ['naked']='α', ['length']='long'},
	['ῑ'] = {['type'] = 'vowel', ['naked']='ι', ['length']='long'},
	['ῡ'] = {['type'] = 'vowel', ['naked']='υ', ['length']='long'},
	['ἂ'] = {['type'] = 'vowel', ['naked']='α', ['breath']='smooth', ['accent']='grave'},
	['ἒ'] = {['type'] = 'vowel', ['naked']='ε', ['breath']='smooth', ['accent']='grave'},
	['ἢ'] = {['type'] = 'vowel', ['naked']='η', ['breath']='smooth', ['accent']='grave'},
	['ἲ'] = {['type'] = 'vowel', ['naked']='ι', ['breath']='smooth', ['accent']='grave'},
	['ὂ'] = {['type'] = 'vowel', ['naked']='ο', ['breath']='smooth', ['accent']='grave'},
	['ὒ'] = {['type'] = 'vowel', ['naked']='υ', ['breath']='smooth', ['accent']='grave'},
	['ὢ'] = {['type'] = 'vowel', ['naked']='ω', ['breath']='smooth', ['accent']='grave'},
	['ὲ'] = {['type'] = 'vowel', ['naked']='ε', ['accent']='grave'},
	['ᾂ'] = {['type'] = 'vowel', ['naked']='α', ['breath']='smooth', ['accent']='grave', ['subi']=true},
	['ᾒ'] = {['type'] = 'vowel', ['naked']='η', ['breath']='smooth', ['accent']='grave', ['subi']=true},
	['ᾢ'] = {['type'] = 'vowel', ['naked']='ω', ['breath']='smooth', ['accent']='grave', ['subi']=true},
	['ᾲ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='grave', ['subi']=true},
	['ῂ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='grave', ['subi']=true},
	['ῒ'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='grave', ['diar']=true},
	['ῢ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='grave', ['diar']=true},
	['ῲ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='grave', ['subi']=true},
	['ἃ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='grave', ['breath']='rough'},
	['ἓ'] = {['type'] = 'vowel', ['naked']='ε', ['accent']='grave', ['breath']='rough'},
	['ἣ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='grave', ['breath']='rough'},
	['ἳ'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='grave', ['breath']='rough'},
	['ὃ'] = {['type'] = 'vowel', ['naked']='ο', ['accent']='grave', ['breath']='rough'},
	['ὓ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='grave', ['breath']='rough'},
	['ὣ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='grave', ['breath']='rough'},
	['έ'] = {['type'] = 'vowel', ['naked']='ε', ['accent']='acute'},
	['ᾃ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='grave', ['breath']='rough', ['subi']=true},
	['ᾓ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='grave', ['breath']='rough', ['subi']=true},
	['ᾣ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='grave', ['breath']='rough', ['subi']=true},
	['ᾳ'] = {['type'] = 'vowel', ['naked']='α', ['subi']=true},
	['ῃ'] = {['type'] = 'vowel', ['naked']='η', ['subi']=true},
	['ΐ'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='acute', ['diar']=true},
	['ΰ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='acute', ['diar']=true},
	['ῳ'] = {['type'] = 'vowel', ['naked']='ω', ['subi']=true},
	['ἄ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='acute', ['breath']='smooth'},
	['ἔ'] = {['type'] = 'vowel', ['naked']='ε', ['accent']='acute', ['breath']='smooth'},
	['ἤ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='acute', ['breath']='smooth'},
	['ἴ'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='acute', ['breath']='smooth'},
	['ὄ'] = {['type'] = 'vowel', ['naked']='ο', ['accent']='acute', ['breath']='smooth'},
	['ὔ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='acute', ['breath']='smooth'},
	['ὤ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='acute', ['breath']='smooth'},
	['ὴ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='grave'},
	['ᾄ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='acute', ['breath']='smooth', ['subi']=true},
	['ᾔ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='acute', ['breath']='smooth', ['subi']=true},
	['ᾤ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='acute', ['breath']='smooth', ['subi']=true},
	['ᾴ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='acute', ['subi']=true},
	['ῄ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='acute', ['subi']=true},
	['ῴ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='acute', ['subi']=true},
	['ἅ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='acute', ['breath']='rough'},
	['ἕ'] = {['type'] = 'vowel', ['naked']='ε', ['accent']='acute', ['breath']='rough'},
	['ἥ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='acute', ['breath']='rough'},
	['ἵ'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='acute', ['breath']='rough'},
	['ὅ'] = {['type'] = 'vowel', ['naked']='ο', ['accent']='acute', ['breath']='rough'},
	['ὕ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='acute', ['breath']='rough'},
	['ὥ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='acute', ['breath']='rough'},
	['ή'] = {['type'] = 'vowel', ['naked']='η', ['accent']='acute'},	
	['ᾅ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='acute', ['breath']='rough', ['subi']=true},
	['ᾕ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='acute', ['breath']='rough', ['subi']=true},
	['ᾥ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='acute', ['breath']='rough', ['subi']=true},
	['ἆ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='circum', ['breath']='smooth'},
	['ἦ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='circum', ['breath']='smooth'},
	['ἶ'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='circum', ['breath']='smooth'},
	['ὖ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='circum', ['breath']='smooth'},	
	['ὦ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='circum', ['breath']='smooth'},
	['ὶ'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='grave'},
	['ᾆ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='circum', ['breath']='smooth', ['subi']=true},
	['ᾖ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='circum', ['breath']='smooth', ['subi']=true},
	['ᾦ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='circum', ['breath']='smooth', ['subi']=true},
	['ᾶ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='circum'},
	['ῆ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='circum'},
	['ῖ'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='circum'},	
	['ῦ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='circum'},
	['ῶ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='circum'},
	['ἇ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='circum', ['breath']='rough'},
	['ἧ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='circum', ['breath']='rough'},
	['ἷ'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='circum', ['breath']='rough'},
	['ὗ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='circum', ['breath']='rough'},
	['ὧ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='circum', ['breath']='rough'},
	['ί'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='acute'},	
	['ᾇ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='circum', ['breath']='rough', ['subi']=true},
	['ᾗ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='circum', ['breath']='rough', ['subi']=true},
	['ᾧ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='circum', ['breath']='rough', ['subi']=true},
	['ᾷ'] = {['type'] = 'vowel', ['naked']='α', ['accent']='circum', ['subi']=true},
	['ῇ'] = {['type'] = 'vowel', ['naked']='η', ['accent']='circum', ['subi']=true},
	['ῗ'] = {['type'] = 'vowel', ['naked']='ι', ['accent']='circum', ['diar']=true},
	['ῧ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='circum', ['diar']=true},
	['ῷ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='circum', ['subi']=true},
	['ὸ'] = {['type'] = 'vowel', ['naked']='ο', ['accent']='grave'},
	['ό'] = {['type'] = 'vowel', ['naked']='ο', ['accent']='acute'},
	['ὺ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='grave'},
	['ύ'] = {['type'] = 'vowel', ['naked']='υ', ['accent']='acute'},
	['ὼ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='grave'},
	['ώ'] = {['type'] = 'vowel', ['naked']='ω', ['accent']='acute'},
	['αι'] = {['p'] = {['cla'] = {{'1.end', 'a'..d7..d1..'ɪ'..d7}, 'a'..d1..'ɪ'}, ['koi1']='ɛ', ['koi2']='ɛ', ['byz1']='e', ['byz2']='e'}},
	['ει'] = {['p'] = {['cla'] = 'e', ['koi1']='i', ['koi2']='i', ['byz1']='i', ['byz2']='i'}},
	['οι'] = {['p'] = {['cla'] = {{'1.end', 'o'..d7..d1..'ɪ'..d7}, 'o'..d1..'ɪ'}, ['koi1']='y', ['koi2']='y', ['byz1']='y', ['byz2']='i'}},
	['υι'] = {['p'] = {['cla'] = 'y', ['koi1']='y', ['koi2']='y', ['byz1']='y', ['byz2']='i'}},
	['αυ'] = {['p'] = {['cla'] = 'a'..d1..'ʊ', ['koi1']={{'1.unvoiced', 'aʍ'}, 'aw'}, 
		['koi2']={{'1.unvoiced', 'aɸ'}, 'aβ'}, ['byz1']={{'1.unvoiced', 'af'}, 'av'}, 
		['byz2']={{'1.unvoiced', 'af'}, 'av'}}},
	['ευ'] = {['p'] = {['cla'] = 'e'..d1..'ʊ', ['koi1']={{'1.unvoiced', 'eʍ'}, 'ew'}, 
		['koi2']={{'1.unvoiced', 'eɸ'}, 'eβ'}, ['byz1']={{'1.unvoiced', 'ef'}, 'ev'}, 
		['byz2']={{'1.unvoiced', 'ef'}, 'ev'}}},
	['ου'] = {['p'] = {['cla'] = 'o', ['koi1']='u', ['koi2']='u', ['byz1']='u', ['byz2']='u'}},
	}

local uStart = {['α'] = true, ['ε'] = true, ['ο'] = true}
local iStart = {['α'] = true, ['ε'] = true, ['ο'] = true, ['υ'] = true}

local iCons = {['b']=true, ['ɡ']=true, ['ŋ']=true, ['d']=true, ['z']=true, 
	['k']=true, ['l']=true, ['m']=true, ['n']=true, ['p']=true, ['r']=true, 
	['s']=true, ['t']=true, ['β']=true, ['ð']=true, ['ɣ']=true, ['ɸ']=true, 
	['θ']=true, ['x']=true, ['f']=true, ['v']=true, ['ɟ']=true, ['ʝ']=true, 
	['c']=true, ['ç']=true}

local iVows = {['a']=true, ['e']=true, ['i']=true, ['o']=true, ['u']=true, 
	['y']=true, ['ʊ']=true, ['ɪ']=true, ['ɛ']=true, ['ɔ']=true}

local iDias = {[d2]=true, [d3]=true, [d4]=true, [d5]=true, [d6]=true, [d7]=true,
	['ʰ']=true, ['ː']=true, ['̥']=true}

local iLiqs = {['r']=true, ['l']=true, ['n']=true}

local iStops = {['b']=true, ['ɡ']=true, ['d']=true, ['k']=true, ['p']=true, 
	['t']=true, ['β']=true, ['ð']=true, ['ɣ']=true, ['ɸ']=true, ['θ']=true, 
	['x']=true, ['f']=true}


function export.create(frame)
	local title = frame.args[1]
	title = mw.ustring.lower(title)
	title = mw.ustring.gsub(title, 'ς', 'σ')
	title = mw.ustring.gsub(title, 'ῤ', 'ρ')
	for i=1, #periods do
		IPAs[periods[i]] = {['notes']={}}
	end
	local length = mw.ustring.len(title)
	local x = 1
	local letter = ''
	local nextLetter = ''
	local cla = {}
	local alert = false
	local naked = ''
	local accent = ''
	local diphthong = false
	
	
	local function preFront(which)
		local fronts = {['ι']=true, ['η']=true, ['ε']=true}
		local nLet = mw.ustring.sub(title, x+1+which, x+1+which)
		local nnLet = mw.ustring.sub(title, x+2+which, x+2+which)
		if fronts[((l[nLet].naked) or nLet)] then
			return true
		elseif (nLet == 'a' or nLet == 'ο') and ((l[nnLet].naked or nnLet) == 'ι') then
			return true
		else
			return false
		end
	end

	local function decode(condition)
		if mw.ustring.find(condition, '[+/]') then  
			
			
			
			local sep = mw.ustring.find(condition, "[/+][^/+]*$")  
			local chunk1 = mw.ustring.sub(condition, 1, sep - 1)
			local chunk2 = mw.ustring.sub(condition, sep + 1)
			if mw.ustring.sub(condition, sep, sep) == '/' then
				return decode(chunk1) or decode(chunk2)
			elseif mw.ustring.sub(condition, sep, sep) == '+' then
				return decode(chunk1) and decode(chunk2)
			end
		elseif mw.ustring.find(condition, '=') then
			local sep = mw.ustring.find(condition, '=')  
			local chunk1 = mw.ustring.sub(condition, 1, sep - 1)
			local chunk2 = mw.ustring.sub(condition, sep + 1)
			local checkLetter
			if tonumber(x+chunk1) < 1 then
				checkLetter = ''
			else 
				checkLetter = mw.ustring.sub(title, x+chunk1, x+chunk1)
			end
			return checkLetter == chunk2
		elseif mw.ustring.find(condition, '%.') then
			local sep = mw.ustring.find(condition, '%.')  
			local chunk1 = mw.ustring.sub(condition, 1, sep - 1)
			local chunk2 = mw.ustring.sub(condition, sep + 1)
			local checkLetter = mw.ustring.sub(title, x+chunk1, x+chunk1)
			return l[checkLetter][chunk2]
		elseif mw.ustring.find(condition, '%-') then
			local sep = mw.ustring.find(condition, '%-')
			local chunk1 = mw.ustring.sub(condition, 1, sep - 1)
			local chunk2 = mw.ustring.sub(condition, sep + 1)
			if chunk2 == 'preFront' then
				return preFront(chunk1)
			end
		end
				
	end
	local function check(p, period)
		if type(p) == 'string' then
			return p
		elseif type(p) == 'table' then   
			for i = 1, #p do
				possP = p[i]
				if type(possP) == 'string' then
					return possP
				elseif type(possP) == 'table' then    
					rawCondition = possP[1]
					rawResult = possP[2]
					local condition = decode(rawCondition)
					if condition then
						if type(rawResult) == 'string' then
							return rawResult
						else
							return check(rawResult, period)
						end
					end	
				end
			end
		end
	end
	while x <= length do
		letter = mw.ustring.sub(title, x, x)
		nextLetter = mw.ustring.sub(title, x+1, x+1)
		if not l[letter] then
			
		elseif l[letter].type == 'consonant' then
			for i = 1, #periods do
				period = periods[i]
				currentP = l[letter].p[period]
				result = check(currentP, period)
				table.insert(IPAs[period], result)
			end
		
		elseif l[letter].type == 'vowel' then
		
			
			local diphthong = false
			local vCurrent, vForm, vLength;
			if iStart[letter] and (l[nextLetter] and l[nextLetter].type == 'vowel' and (nextLetter == 'ι' or (l[nextLetter].naked and l[nextLetter].naked == 'ι' and not l[nextLetter].diar))) then
				diphthong = letter..'ι'
			elseif uStart[letter] and (l[nextLetter] and l[nextLetter].type == 'vowel' and (nextLetter == 'υ' or (l[nextLetter].naked and l[nextLetter].naked == 'υ' and not l[nextLetter].diar))) then
				diphthong = letter..'υ'
			end
			
			if diphthong then
				vCurrent = nextLetter
				vForm = diphthong
				vLength = 'long'
				x = x + 1
				nextLetter = mw.ustring.sub(title, x+1, x+1)
			else 
				vCurrent = letter
				vForm = l[letter].naked or letter
				vLength = l[vCurrent].length or l[vForm].length
			end
			for i = 1, #periods do
				period = periods[i]
				if period == 'cla' then
					if l[vCurrent].breath == 'rough' then
						table.insert(IPAs['cla'], 'h')
					end
				elseif period == 'koi1' then
					if l[vCurrent].breath == 'rough' then
						table.insert(IPAs['koi1'], '(h)')
					end
				end
				if period ~= 'cla' then
					
					
					
					if l[vCurrent].accent then
						table.insert(IPAs[period], 'ˈ')
					end
					local vIP = check(l[vForm].p[period], period)
					table.insert(IPAs[period], vIP)
					
				else
					
					if vLength == 'either' then
						if l[vCurrent].accent == 'circum' then
							vLength = 'long'
						elseif l[vCurrent].subi then
							vLength = 'long'
						elseif nextLetter == '̄' or nextLetter == '¯' then
							vLength = 'long'
						elseif nextLetter == '̆' or nextLetter == '˘' then
							vLength = 'short'
						else
							table.insert(IPAs.cla.notes, '')
						end
					end
					
					local vIP = check(l[vForm].p.cla, cla)  
					
					
					if mw.ustring.len(vIP) > 1 then  
						if l[vCurrent].accent == 'acute' then
							vFP = vIP..d2
						elseif l[vCurrent].accent == 'grave' then
							vFP = vIP..d3
						elseif l[vCurrent].accent == 'circum' then
							vFP = mw.ustring.sub(vIP, 1, 1)..d2..mw.ustring.sub(vIP, 2)
						else
							vFP = vIP
						end
					elseif l[vCurrent].subi then
						if l[vCurrent].accent == 'acute' then
							vFP = vIP..d1..'ːɪ'..d2
						elseif l[vCurrent].accent == 'grave' then
							vFP = vIP..d1..'ːɪ'..d3
						elseif l[vCurrent].accent == 'circum' then
							vFP = vIP..d2..d1..'ːɪ'
						else
							vFP = vIP..d1..'ːɪ'
						end
					elseif vLength == 'long' then
						if l[vCurrent].accent == 'acute' then
							vFP = vIP..d4..'ː'
						elseif l[vCurrent].accent == 'grave' then
							vFP = vIP..d5..'ː'
						elseif l[vCurrent].accent == 'circum' then
							vFP = vIP..d6..'ː'
						else
							vFP = vIP..'ː'
						end
					else
						if l[vCurrent].accent == 'acute' then
							vFP = vIP..d2
						elseif l[vCurrent].accent == 'grave' then
							vFP = vIP..d3
						else
							vFP = vIP
						end
					end
					table.insert(IPAs['cla'], vFP)
	
				end
			end
		else
			alert = true
		end
		x = x + 1
	end
	
	
	for i=1, #periods do
		IPAs[periods[i]] = {['IPA']=table.concat(IPAs[periods[i]], ''), ['notes']=IPAs[periods[i]]['notes']}
	end
	
	
	for i=1, #periods do
		local period = periods[i]
		local word = IPAs[period].IPA
		local syllables = {}
		local cVowel, nVowel, sBreak, stress, wordEnd, searching
		
		while word ~= '' do
			cVowel, nVowel, sBreak, stress = false, false, false, false
			
			
			searching = 1
			cVowelFound = false
			while not cVowel do
				letter = mw.ustring.sub(word, searching, searching)
				if cVowelFound then
					if iVows[letter] or iCons[letter] or letter == '' or letter == 'ˈ' then
						cVowel = searching - 1
					elseif iDias[letter] then
						searching = searching + 1
					elseif letter == d1 then
						cVowelFound = false
						searching = searching + 1
					else
						searching = searching + 1
					end
				else
					if iVows[letter] then
						cVowelFound = true
					elseif letter == 'ˈ' then
						stress = true
					elseif letter == '' then  
						cVowel = true
						wordEnd = true
					end
					searching = searching + 1
				end
			end
		
			
			searching = cVowel + 1
			while (not nVowel) and (not wordEnd) do
				letter = mw.ustring.sub(word, searching, searching)
				if iVows[letter] or letter == 'ˈ' then
					nVowel = searching
				elseif letter == '' then
					wordEnd = true
				else
					searching = searching + 1
				end
			end
			
			
			if wordEnd then
				sBreak = mw.ustring.len(word)
			elseif iLiqs[mw.ustring.sub(word, nVowel-1, nVowel-1)] then
				if iStops[mw.ustring.sub(word, nVowel-2, nVowel-2)] then
					sBreak = nVowel - 3
				elseif mw.ustring.sub(word, nVowel-2, nVowel-2) == 'ʰ' and iStops[mw.ustring.sub(word, nVowel-3, nVowel-3)] then
					sBreak = nVowel - 4
				else
					sBreak = nVowel - 2
				end
			elseif iCons[mw.ustring.sub(word, nVowel-1, nVowel-1)] then
				sBreak = nVowel - 2
			elseif mw.ustring.sub(word, nVowel-1, nVowel-1) == 'ʰ' and iStops[mw.ustring.sub(word, nVowel-2, nVowel-2)] then
				sBreak = nVowel - 3
			elseif mw.ustring.sub(word, nVowel-1, nVowel-1) == '̥' and mw.ustring.sub(word, nVowel-2, nVowel-2) == 'r' then
				sBreak = nVowel - 3
			else
				sBreak = nVowel - 1
			end
			
			
			local syllable = mw.ustring.sub(word, 1, sBreak)
			
			
			
			
			if stress then
				if next(syllables) or syllable ~= word then
					syllable = 'ˈ'..mw.ustring.gsub(syllable, 'ˈ', '')
				else 
					syllable = mw.ustring.gsub(syllable, 'ˈ', '')
				end
				stress = false
			end
			table.insert(syllables, syllable)
			word = mw.ustring.sub(word, sBreak+1)
		end
		
		if #syllables > 0 then
			IPAs[period].IPA = table.concat(syllables, '.')
		end
	end	
	
	
	local inlineProns = 'МФА: '
	for i=1, #inlinePeriods do
		period = inlinePeriods[i]
		inlineProns = inlineProns..'<span class="IPA" lang="grc">['..IPAs[period].IPA..']</span>'
		if period ~= 'byz2' then
			inlineProns = inlineProns..' → '
		end
	end
	--local inlineProns = inlineProns..'|'
	local fullProns = '\n'
	for i=1, #periods do
		period = periods[i]
		local notes = ''
		if #IPAs[period].notes > 0 then
			notes = table.concat(IPAs[period].notes, '')
		end
		fullProns = fullProns..'* '..periodLabels[period]..': ['..IPAs[period].IPA..']'..notes
		if period ~= 'byz2' then
			fullProns = fullProns..'\n'
		end
	end
	fullProns = fullProns..'<br>'
	local final = inlineProns..fullProns
	return frame:preprocess(final)
end

return export