48,355
edits
(Created page with "local export = {} local m_u = require('Module:utilities') local m_l = require('Module:links') local m_pron = require('Module:pine-pron') local lang = require('Module:languages').getByCode("pine") local sub = mw.ustring.sub local find = mw.ustring.find local match = mw.ustring.match local gmatch = mw.ustring.gmatch local gsub = mw.ustring.gsub local u = mw.ustring.char local split = mw.text.split local gsplit = mw.text.gsplit local PAGENAME = mw.title.getCurrentTitle()...") |
No edit summary |
||
| Line 3: | Line 3: | ||
local m_u = require('Module:utilities') | local m_u = require('Module:utilities') | ||
local m_l = require('Module:links') | local m_l = require('Module:links') | ||
local m_t = require('Module:table') | |||
local m_pron = require('Module:pine-pron') | local m_pron = require('Module:pine-pron') | ||
local lang = require('Module:languages').getByCode("pine") | local lang = require('Module:languages').getByCode("pine") | ||
| Line 17: | Line 18: | ||
local PAGENAME = mw.title.getCurrentTitle().text | local PAGENAME = mw.title.getCurrentTitle().text | ||
local NAMESPACE = mw.title.getCurrentTitle().nsText | local NAMESPACE = mw.title.getCurrentTitle().nsText | ||
local vowels = "aeiouyůảẻỉỏủỷ" | |||
local consonants = "[rṛtpsṡdḍgġhḥkḳlḷƛvbnṇmṃ]" | |||
local labial = m_t.listToSet({ | |||
"m", "ṃ", "p", "b", "v" | |||
}, "labial") | |||
local coronal = m_t.listToSet({ | |||
"t", "d", "ḍ", "s", "ṡ", "r", "ṛ", "l", "ḷ", "ƛ", "n", "ṇ", | |||
"ts", "tṡ", "lį", "ḷį", "nį", "ṇį", "dn", "ng", "kn" | |||
}, "coronal") | |||
local dorsal = m_t.listToSet({ | |||
"k", "g", "ġ", "h", "ḥ", | |||
"hį", "kṇ", "tġ" | |||
}, "dorsal") | |||
local front = m_t.listToSet({ | |||
"e", "i", "ů", "y", "ả", "ẻ", "ỉ", "ỷ", | |||
"ai", | |||
}, "front") | |||
local back = m_t.listToSet({ | |||
"a", "o", "u", "ỏ", "ủ", | |||
"oa", "oi", | |||
}, "back") | |||
local function quality_lookup(segment, tables) | |||
if not segment then return nil end | |||
for _, tbl in ipairs(poas) do | |||
if tbl[segment] then return tbl[segment] end | |||
end | |||
-- fallback to first letter | |||
local first = segment:sub(1,1) | |||
for _, tbl in ipairs(poas) do | |||
if tbl[first] then return tbl[first] end | |||
end | |||
end | |||
local function detect_decl(word) | local function detect_decl(word) | ||
local syllabified = m_pron.syllabify_from_spelling(word) | |||
--syllabified = gsub(syllabified, "·(" .. consonants .. ")%1", "%1·%1") | |||
--syllabified = gsub(syllabified, "t·(t[sṡ])", "%1·%1") | |||
local syllables = split(syllabified, "·") | |||
local number_of_syllables = #syllables | |||
local stressed_syllable = syllables[1] | |||
if number_of_syllables == 1 then | |||
-- monosyllabic | |||
else | |||
local last_syllable = syllables[number_of_syllables] | |||
local onset = match(stressed_syllable, "^" .. consonants .. "+") -- nil if vowel-initial | |||
local coda = match(stressed_syllable, consonants .. "$") or match(syllables[2], "^" .. consonants .. "+") | |||
local poas = {labial, coronal, dorsal} | |||
local poa_onset = quality_lookup(onset, poas) | |||
local poa_coda = quality_lookup(coda, poas) | |||
local aphonicity = onset and "archeaphonic" or "enteraphonic" | |||
local organicity = poa_onset and (poa_onset == poa_coda and "homorganic" or "heterorganic") or nil | |||
local nucleus = match(stressed_syllable, "^" .. consonants .. "*(" .. vowels .. "+)") | |||
local last_vowel = match(last_syllable, "(" .. vowels .. "+)$") -- nil if consonant-final | |||
local polarity = {front, back} | |||
local pol_nucleus = quality_lookup(nucleus, polarity) | |||
local pol_last = quality_lookup(last_vowel, polarity) | |||
local phonicity = not last_vowel and "consonantal" or pol_nucleus == pol_last and "symphonic" or "antiphonic" | |||
end | |||
end | end | ||