Language code in page name (User:OblivionKhorasan/skr
) not recognized.
local m_str_utils = require("Module:string utilities")
local U = m_str_utils.char
local gsub = m_str_utils.gsub
local export = {}
local nasal = 'J'
local nasalised = '̃'
local nasalc = "mnɳɲŋ"
local aspirate = "ʰʱ"
local unvoiced = "ptʈçk"
local stress = "ˈˌ"
local consonants = "pbɓtdɗʈɖᶑɽçɟʄkɡɠɾlɭsɦʃʋqxɣzfmnɳɲŋj"
local schwac = "pbɓtdɗʈɖᶑɽçɟʄkɡɠɾlɭsʃqzfʰʱmnɳɲŋ"
local gem = "pbɓtdɗʈɖᶑçɟʄkɡɠlsʃqxɣzfʰʱmnɲŋ"
local ungem = "ɳɭɾɽjʋɦ"
local vowels = "əɪʊaiueoɛɔ"
local shortvowels = "əɪʊ"
local longvowels = "aiueoɛɔ"
local long = "ː"
local nonsyllabic = '̯'
local labial = "pbɓf"
local dental = "tdɗ"
local retroflex = "ʈɖᶑ"
local postalveolar = "çɟʄ"
local velar = "kɡɠ"
local postvelar = "xɣ"
local sibilant = "sʃɦ"
local mapping = {
= 'ʈ', = 'ɖ', = 'ɳ',
= "ɽ",
= 'ç', = 'ɟ', = 'ɲ',
= 'ɡ',
= 'j', = 'ɾ', = 'ɭ', = 'ʋ',
= "ɦ",
= "ʃ", = "ɣ",
= 'ə', = 'ɪ', = 'ʊ',
= 'a', = 'i', = 'u', = 'ɛ', = 'ɔ',
= "J",
= 'ˈ',
= 'ˌ',
= 'ʱ',
}
function export.tr(text, lang, sc)
--define the "end" of a word
text = gsub(text, "#", "HASHTAG")
text = gsub(text, " | ", "# | #")
text = gsub(text, "\n" , "#".."\n" .. "#")
text = "##" .. gsub(text, " ", "# #") .. "##"
-- hastags now mark the beginning and end of a word
text = gsub(text, '.', mapping)
-- implosives
text = gsub(text, "b'", "ɓ")
text = gsub(text, "d'", "ɗ")
text = gsub(text, "ɖ'", "ᶑ")
text = gsub(text, "ɟ'", "ʄ")
text = gsub(text, "ɡ'", "ɠ")
-- unvoiced aspirates
text = gsub(text, '()' .. '()', "%1ʰ")
-- nasalise vowels
text = gsub(text, '()' .. '()' .. '()', "%1̃%2%3")
text = gsub(text, '()' .. '()' .. '()', "%1%2̃%3")
text = gsub(text, '()' .. '()' .. '()' .. '()', "%1%2%3̃%4")
text = gsub(text, "#" .. '()' .. '()' .. '()' .. "#", "%1%2̃.%3")
-- nasal consonant combinations
text = gsub(text, '()' .. '()' .. '()', "%1̃m%3")
text = gsub(text, '()' .. '()' .. '()', "%1̃n%3")
text = gsub(text, '()' .. '()' .. '()', "%1̃ɳ%3")
text = gsub(text, '()' .. '()' .. '()', "%1̃n̠%3")
text = gsub(text, '()' .. '()' .. '()', "%1̃ŋ%3")
text = gsub(text, '()' .. '()' .. '()', "%1̃ŋ̄%3")
text = gsub(text, '()' .. '()' .. '()', "%1̃%3")
text = gsub(text, '()' .. '()' .. "#", "%1̃")
-- stressed variants (not sure how to condense)
text = gsub(text, '()' .. '()' .. '()' .. '()', "%1̃m%3%4")
text = gsub(text, '()' .. '()' .. '()' .. '()', "%1̃n%3%4")
text = gsub(text, '()' .. '()' .. '()' .. '()', "%1̃ɳ%3%4")
text = gsub(text, '()' .. '()' .. '()' .. '()', "%1̃n̠%3%4")
text = gsub(text, '()' .. '()' .. '()' .. '()', "%1̃ŋ%3%4")
text = gsub(text, '()' .. '()' .. '()' .. '()', "%1̃ŋ̄%3%4")
text = gsub(text, '()' .. '()' .. '()' .. '()', "%1̃%3%4")
-- vowel lengthening
text = gsub(text, '()' .. '()', "%1ː%2")
text = gsub(text, '()' .. '()' .. '()', "%1%2ː%3")
text = gsub(text, '()' .. "#", "%1ː")
text = gsub(text, '()' .. '()' .. "#", "%1ː%2")
text = gsub(text, '()' .. '()' .. '()', "%1%2ː%3")
text = gsub(text, '()' .. '()' .. '()' .. '()', "%1%2%3ː%4")
-- consonant doubling after stressed long vowels
text = gsub(text, '()' .. '()' .. '()' .. '()' .. '()', "%1%2%3%4%4%5")
text = gsub(text, '()' .. '()' .. '()' .. '()' .. '()' .. '()', "%1%2%3%4%4%5%6")
-- iy cluster
text = gsub(text, "ɪj", "i.j")
text = gsub(text, "ɪ" .. '()' .. "j", "i%1j")
text = gsub(text, "jj", "i̯.j")
-- schwa release
text = gsub(text, '()' .. "#", "%1ə̆")
-- syllables
text = gsub(text, '()' .. '()' .. '()' .. '()', "%1%2.%3%4") -- separates consonants
text = gsub(text, '()' .. '()' .. '()' .. '()' .. '()', "%1%2.%3%4%5")
text = gsub(text, '()' .. '()' .. '()', "%1.%2%3") -- separates C-V
text = gsub(text, '()' .. '()', "%1.%2")
text = gsub(text, '()' .. '()' .. '()', "%1%2.%3")
text = gsub(text, '()' .. '()', "%1.%2") -- separates vowel clusters
text = gsub(text, "." .. '()' .. '()', "%1%2") -- nonsyllabic vowel clusters
-- repairing n̠
text = gsub(text, '()' .. '()', "%1.%2")
-- ñ fix
text = gsub(text, '()' .. '()' .. '()', "%1%3%2%3")
-- manual fix
text = gsub(text, '()' .. '()' .. '()', "%1%2")
text = gsub(text, '()' .. '()' .. '()', "%1.%2%3")
-- get rid of hashtags (not needed)
text = gsub(text, "#", "")
text = gsub(text, "HASHTAG", "#")
--
return text
end
return export