Difference between revisions of "Module:User:AmazingJus/turkish/narrow"
Jump to navigation
Jump to search
blackwiki>AmazingJus |
m (67 revisions imported) |
||
| (9 intermediate revisions by one other user not shown) | |||
| Line 4: | Line 4: | ||
local match = mw.ustring.match | local match = mw.ustring.match | ||
local gsub = mw.ustring.gsub | local gsub = mw.ustring.gsub | ||
| + | local m_broad = require("Module:User:AmazingJus/turkish") | ||
local ring = U(0x30A) | local ring = U(0x30A) | ||
| Line 13: | Line 14: | ||
-- we need to use the broad transcription first in order for this to work properly | -- 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 21: | ||
end | end | ||
| + | local b = "ɯuɑo" | ||
| + | local f = "iyeø" | ||
local r = "yuøo" | local r = "yuøo" | ||
local u = "ɯɑie" | local u = "ɯɑie" | ||
| − | |||
| − | |||
local v = "yuøoɯɑie" | local v = "yuøoɯɑie" | ||
| Line 29: | Line 31: | ||
-- consonants | -- consonants | ||
| + | text = gsub(text, "([^" .. v .. "])\.%1", "%1ː") -- also broken up syllables are okay as well | ||
| + | |||
if match(text, "[" .. r .. "]") then | if match(text, "[" .. r .. "]") then | ||
text = gsub(text, "f([" .. r .. "])", "ɸ%1") | text = gsub(text, "f([" .. r .. "])", "ɸ%1") | ||
| Line 67: | Line 71: | ||
-- alternatives | -- alternatives | ||
| − | |||
Latest revision as of 04:56, 30 September 2020
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 m_broad = require("Module:User:AmazingJus/turkish")
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 b = "ɯuɑo"
local f = "iyeø"
local r = "yuøo"
local u = "ɯɑie"
local v = "yuøoɯɑie"
-- make all word borders have a space
text = " " .. text .. " "
-- consonants
text = gsub(text, "([^" .. v .. "])\.%1", "%1ː") -- also broken up syllables are okay as well
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
return mw.text.trim(text)
end
return export