Module:pine-pron: Difference between revisions

1,125 bytes removed ,  25 November 2025
no edit summary
No edit summary
No edit summary
Line 66: Line 66:
term = gsub(term, "(t[sṡ])", {["ts"] = "ʦ", ["tṡ"] = "ʧ"})
term = gsub(term, "(t[sṡ])", {["ts"] = "ʦ", ["tṡ"] = "ʧ"})
--term = term:gsub("([ṛḍḥḳḷṇṃ])", function(c) return mw.ustring.toNFC(mw.ustring.toNFD(c)) end)
--term = term:gsub("([ṡ])", function(c) return mw.ustring.toNFC(mw.ustring.toNFD(c)) end)
local words = split(term, "%s")
local words = split(term, "%s")
for i, word in ipairs(words) do
for i, word in ipairs(words) do
word = gsub(word, "(" .. consonants .. "*)(" .. vowels .. "+)(" .. consonants .. "*)", "%1%2.%3")
word = gsub(word, "(" .. consonants .. "*)(" .. vowels .. "+)(" .. consonants .. "*)", "%1%%3")
word = gsub(word, "%.$", "") --word = word:gsub("%.(" .. consonants .. "?)$", "%1")
word = word:gsub("·(" .. consonants .. "?)$", "%1")
--word = word:gsub("%.(" .. consonants .. ")(" .. consonants .. "+)", "%1.%2")
words[i] = word
words[i] = word
end
end
--[[ substitutions for easier processing
local digraphs = {
["tṡ"] = "ʧ", ["ng"] = "ŋ", ["ts"] = "ʦ",
["gį"] = "ɟ", ["nį"] = "ɲ", ["ṇį"] = "ɳ",
["kį"] = "c", ["ḥį"] = "ʔ", ["ḍį"] = "θ",
["hį"] = "ɕ", ["lį"] = "ʎ", ["ḷį"] = "ʟ",
}
term = term:gsub("(.)%1į", "%1įː") -- e.g. nnį > nį:
for digraph, repl in pairs(digraphs) do
        term = term:gsub(digraph, repl)
    end
-- Split between spaces if term is multiword
local words = split(term, "%s")
for i, word in ipairs(words) do
word = word:gsub("(" .. consonants .. "ː?)(" .. consonants .. "+)", "%1·%2")
word = word:gsub("^(" .. consonants .. ")·", "%1"); word = word:gsub("·(" .. consonants .. ")$", "%1")
words[i] = word
end]]
return table.concat(words, " ")
return table.concat(words, " ")
Line 106: Line 79:


function export.crux(term)
function export.crux(term)
--term = mw.ustring.toNFC(mw.ustring.toNFD(term))
term = export.syllabify_from_spelling(term)
term = export.syllabify_from_spelling(term)
local debug_syllables = true
local debug_syllables = true