Difference between revisions of "Module:User:AmazingJus/turkish/narrow"
Jump to navigation
Jump to search
blackwiki>AmazingJus |
blackwiki>AmazingJus |
||
| Line 12: | Line 12: | ||
local breve = U(0x361) | local breve = U(0x361) | ||
| − | -- | + | -- we need to use the broad transcription first in order for this to work properly |
function export.phonetic(text) | function export.phonetic(text) | ||
| Line 19: | Line 19: | ||
end | end | ||
| − | local | + | local r = "yuøo" |
| − | local | + | local u = "ɯɑie" |
| − | local | + | local f = "iyeø" |
| − | local | + | local b = "ɯuɑo" |
| − | local | + | local v = "yuøoɯɑie" |
-- make all word borders have a space | -- make all word borders have a space | ||
| Line 29: | Line 29: | ||
-- consonants | -- consonants | ||
| − | if match(text, "[" .. | + | if match(text, "[" .. r .. "]") then |
| − | text = gsub(text, "f([" .. | + | text = gsub(text, "f([" .. r .. "])", "ɸ%1") |
| − | text = gsub(text, "([" .. | + | text = gsub(text, "([" .. r .. "]ː?)([.ˈ]?)f", "%1%2v\/ɸ") |
| − | text = gsub(text, "([" .. | + | text = gsub(text, "([" .. v .. "]ː?)([.ˈ]?)v([" .. r .. "])", "%1%2β" .. tack .. "%3") |
| − | text = gsub(text, "([" .. | + | text = gsub(text, "([" .. r .. "]ː?)([.ˈ]?)v([" .. u .. "])", "%1%2v\/β" .. tack .. "%3") |
| − | text = gsub(text, "([^" .. | + | text = gsub(text, "([^" .. r .. "]ː?)([.ˈ]?)v([" .. r .. "])", "%1%2β%3") |
| − | text = gsub(text, "([" .. | + | text = gsub(text, "([" .. r .. "]ː?)([.ˈ]?)v([^" .. v .. "])", "%1%2β%3") |
end | end | ||
| Line 52: | Line 52: | ||
text = gsub(text, "([ntdszɫ])([^" .. bridge .. "])", "%1" .. bridge .. "%2") | text = gsub(text, "([ntdszɫ])([^" .. bridge .. "])", "%1" .. bridge .. "%2") | ||
text = gsub(text, "l([^" .. minus .. "])", "l" .. minus .. "ʲ%1") | text = gsub(text, "l([^" .. minus .. "])", "l" .. minus .. "ʲ%1") | ||
| − | text = gsub(text, "([" .. | + | text = gsub(text, "([" .. f .. "]ː?)([.ˈ]?)h", "%1%2ç") |
text = gsub(text, "h ", "x ") | text = gsub(text, "h ", "x ") | ||
| − | text = gsub(text, "([" .. | + | text = gsub(text, "([" .. f .. "]ː?)([.ˈ]?)ɰ([" .. f .. "])", "%1%2ɰ" .. plus .. "\/j%3") |
| − | text = gsub(text, "([" .. | + | text = gsub(text, "([" .. v .. "]?)ɰ ", "%1ː ") |
text = gsub(text, "ɰ([^" .. plus .. "])", "%1") | text = gsub(text, "ɰ([^" .. plus .. "])", "%1") | ||
text = gsub(text, " (ˈ?)ɾ([^" .. tack .. "])", " %1ɾ" .. tack .. "%2") | text = gsub(text, " (ˈ?)ɾ([^" .. tack .. "])", " %1ɾ" .. tack .. "%2") | ||
Revision as of 01:21, 21 September 2017
24 tests failed.
| Text | Expected | Actual | |||
|---|---|---|---|---|---|
|
ordu | [oɾˈdu] | [oɾdu] | ||
|
gâvur | [ɟaˈvuɾ] | [ɟaːvuɾ] | ||
|
düğün | [dyˈɰyn] | [dyɰyn] | ||
|
benim | [beˈnim] | [benim] | ||
|
benim | [ˈbe.nim] | [benim] | ||
|
Türkçe | [ˈtyɾk.t͡ʃe] | [tyɾkt͡ʃe] | ||
|
nerede | [ˈne.ɾe.de] | [neɾede] | ||
|
sükûnet | [sy.cuːˈnet] | [sycuːnet] | ||
|
iktisâden | [ic.tiˈsaː.den] | [ictisaːden] | ||
|
kendi | [cenˈdi] | [cendi] | ||
|
seviyorum | [se.viˈjo.ɾum] | [sevijoɾum] | ||
|
Vaşington | [vaˈʃink.ton] | [vaʃinkton] |
| Text | Expected | Actual | |||
|---|---|---|---|---|---|
|
ordu | [o̞ɾˈd̪ʊ] | [o̞rd̪ʊ] | ||
|
gâvur | [ɟɑˈβ̞uɾ̞̊] | [gâβur] | ||
|
düğün | [d̪yˈɰ̟yn̪] | [d̪üğün̪] | ||
|
benim | [be̞ˈn̪im] | [bæn̪im] | ||
|
benim | [ˈbe̞.n̪im] | [bæn̪im] | ||
|
Türkçe | [ˈt̪ʰyɾ̞̊k.t͡ʃɛ] | [Türkçɛ] | ||
|
nerede | [ˈn̪e̞.ɾe̞.d̪ɛ] | [n̪e̞re̞d̪ɛ] | ||
|
sükûnet | [s̪y.cʰuːˈn̪e̞t̪] | [s̪ükûn̪e̞t̪] | ||
|
iktisâden | [ic.t̪ʰiˈs̪ɑː.d̪æn̪] | [ikt̪is̪âd̪æn̪] | ||
|
kendi | [cʰæn̪ˈd̪ɪ] | [kʰæn̪dɪ] | ||
|
seviyorum | [s̪e̞.viˈjo̞.ɾum] | [s̪e̞viyo̞rum] | ||
|
Vaşington | [vɑˈʃiŋk.t̪ʰo̞n̪] | [Vɑşin̪gt̪o̞n̪] |
| Text | Expected | Actual | |
|---|---|---|---|
| Vaşington | vaşˈington | vaşˈington | |
| Ankara | ˈankara | ˈankara | |
| Oregon | orˈegon | orˈegon | |
| Ordu | ˈordu | ˈordu | |
| Edirne | edˈirne | edˈirne |
Usage
{{#invoke:User:AmazingJus/turkish|function_name}}
local export = {}
-- local m_IPA = require("Module:IPA")
local U = mw.ustring.char
local match = mw.ustring.match
local gsub = mw.ustring.gsub
local ring = U(0x30A)
local tack = U(0x31E)
local plus = U(0x31F)
local minus = U(0x320)
local bridge = U(0x32A)
local breve = U(0x361)
-- we need to use the broad transcription first in order for this to work properly
function export.phonetic(text)
if type(text) == "table" then
text = text.args[1]
end
local r = "yuøo"
local u = "ɯɑie"
local f = "iyeø"
local b = "ɯuɑo"
local v = "yuøoɯɑie"
-- make all word borders have a space
text = " " .. text .. " "
-- consonants
if match(text, "[" .. r .. "]") then
text = gsub(text, "f([" .. r .. "])", "ɸ%1")
text = gsub(text, "([" .. r .. "]ː?)([.ˈ]?)f", "%1%2v\/ɸ")
text = gsub(text, "([" .. v .. "]ː?)([.ˈ]?)v([" .. r .. "])", "%1%2β" .. tack .. "%3")
text = gsub(text, "([" .. r .. "]ː?)([.ˈ]?)v([" .. u .. "])", "%1%2v\/β" .. tack .. "%3")
text = gsub(text, "([^" .. r .. "]ː?)([.ˈ]?)v([" .. r .. "])", "%1%2β%3")
text = gsub(text, "([" .. r .. "]ː?)([.ˈ]?)v([^" .. v .. "])", "%1%2β%3")
end
text = gsub(text, "([.ˈ ][ptck])([^" .. breve .. "])", "%1ʰ%2")
if match(text, "[ɾɫl][.ˈ]?[fcktsʃph]") then
text = gsub(text, "[ɾɫl]", {["ɾ"] = "ɾ" .. tack .. ring, ["ɫ"] = "ɫ" .. bridge .. ring, ["l"] = "l" .. minus .. ring .. "ʲ"})
end
if match(text, "[ɾɫl] ") then
text = gsub(text, "[ɾɫl]", {["ɾ"] = "ɾ" .. tack .. ring, ["ɫ"] = "ɫ" .. bridge .. ring, ["l"] = "l" .. minus .. ring .. "ʲ"})
end
text = gsub(text, "n([.ˈ]?)([kɡ])", "ŋ%1%2")
text = gsub(text, "n([.ˈ]?)([cɟ])", "ɲ%1%2")
text = gsub(text, "([ntdszɫ])([^" .. bridge .. "])", "%1" .. bridge .. "%2")
text = gsub(text, "l([^" .. minus .. "])", "l" .. minus .. "ʲ%1")
text = gsub(text, "([" .. f .. "]ː?)([.ˈ]?)h", "%1%2ç")
text = gsub(text, "h ", "x ")
text = gsub(text, "([" .. f .. "]ː?)([.ˈ]?)ɰ([" .. f .. "])", "%1%2ɰ" .. plus .. "\/j%3")
text = gsub(text, "([" .. v .. "]?)ɰ ", "%1ː ")
text = gsub(text, "ɰ([^" .. plus .. "])", "%1")
text = gsub(text, " (ˈ?)ɾ([^" .. tack .. "])", " %1ɾ" .. tack .. "%2")
-- vowels
mw.logObject(text)
text = gsub(text, "([iyɯueø]) $", {["i"] = "ɪ", ["y"] = "ʏ", ["ɯ"] = "ɯ" .. tack, ["u"] = "ʊ", ["e"] = "ɛ", ["ø"] = "œ"}) -- only at the end of phrases
text = gsub(text, "e([mnlɾ])", "æ%1") -- put another parameter to that it can also be pronounced [e]
text = gsub(text, "a", "ɑ")
text = gsub(text, "([eoø])", "%1" .. tack)
-- alternatives
-- we need to also show assimilation of same adjacent sounds by lengthening
return mw.text.trim(text)
end
return export