48,355
edits
No edit summary |
No edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
local m_u = require('Module:utilities') | local m_u = require('Module:utilities') | ||
local m_su = require('Module:string utilities') | |||
local m_l = require('Module:links') | local m_l = require('Module:links') | ||
local m_t = require('Module:table') | local m_t = require('Module:table') | ||
| Line 8: | Line 9: | ||
local lang = require('Module:languages').getByCode("pine") | local lang = require('Module:languages').getByCode("pine") | ||
local sub = | local sub = m_su.sub | ||
local find = | local find = m_su.find | ||
local match = | local match = m_su.match | ||
local gmatch = | local gmatch = m_su.gmatch | ||
local gsub = | local gsub = m_su.gsub | ||
local u = | local u = m_su.char | ||
local split = | local split = m_su.split | ||
local gsplit = | local gsplit = m_su.gsplit | ||
local len = | local len = m_su.len | ||
local unpack = unpack or table.unpack -- Lua 5.2 compatibility | |||
local PAGENAME = mw.loadData("Module:headword/data").pagename | local PAGENAME = mw.loadData("Module:headword/data").pagename | ||
| Line 55: | Line 57: | ||
end | end | ||
-- fallback to first letter | -- fallback to first letter | ||
local first = | local first = sub(segment,1,1) | ||
for _, tbl in ipairs(tables) do | for _, tbl in ipairs(tables) do | ||
if tbl[first] then return tbl[first] end | if tbl[first] then return tbl[first] end | ||
| Line 61: | Line 63: | ||
end | end | ||
local function detect_decl(word, | local function detect_decl(word, args) | ||
local syllabified = m_pron.syllabify_from_spelling(word) | local syllabified = m_pron.syllabify_from_spelling(word) | ||
--syllabified = gsub(syllabified, "·(" .. consonants .. ")%1", "%1·%1") | --syllabified = gsub(syllabified, "·(" .. consonants .. ")%1", "%1·%1") | ||
| Line 85: | Line 87: | ||
local phonicity = not last_vowel and "consonantal" or pol_nucleus == pol_last and "symphonic" or "antiphonic" | local phonicity = not last_vowel and "consonantal" or pol_nucleus == pol_last and "symphonic" or "antiphonic" | ||
local teleutophonic_ending = m_data.teleutophonic_ending(word) | |||
if teleutophonic_ending then | |||
return "teleutophonic-" .. teleuphonic_ending | return "teleutophonic-" .. teleuphonic_ending | ||
elseif syll_count == 1 then --monosyllabic | elseif syll_count == 1 then --monosyllabic | ||
-- "There is unfortunately no way to tell whether a monosyllabic noun ending in a consonant belongs to | -- "There is unfortunately no way to tell whether a monosyllabic noun ending in a consonant belongs to | ||
-- the consonantal declension group of the schizaphonic declension group" (p. 119) | -- the consonantal declension group of the schizaphonic declension group" (p. 119) | ||
if phonicity == "consonantal" then | |||
if schiz == nil then | if args.schiz == nil then | ||
error(word .. " is a monosyllabic noun ending in a consonant. Disambiguation is needed between consonantal and schizophonic declensions.") | error(word .. " is a monosyllabic noun ending in a consonant. Disambiguation is needed between consonantal and schizophonic declensions.") | ||
else | else | ||
return "monosyllabic-" .. (schiz and "schizaphonic" or "consonantal") | return "monosyllabic-" .. (args.schiz and "schizaphonic" or "consonantal") | ||
end | end | ||
else | else | ||
return "monosyllabic-diphthongal-" .. phonicity | return "monosyllabic-diphthongal-" .. phonicity | ||
end | end | ||
return phonicity | return phonicity | ||
else | else | ||
| Line 110: | Line 113: | ||
local organicity = poa_onset and (poa_onset == poa_coda and "homorganic" or "heterorganic") or nil | local organicity = poa_onset and (poa_onset == poa_coda and "homorganic" or "heterorganic") or nil | ||
if syll_count == 2 then -- | if syll_count == 2 or syll_count == 4 then -- bi- and polysyllabic (4) | ||
return "bisyllabic-" .. (phonicity == "consonantal" and phonicity or aphonicity .. "-" .. (onset and organicity .. "-" or "") .. phonicity) | return "bisyllabic-" .. (phonicity == "consonantal" and phonicity or aphonicity .. "-" .. (onset and organicity .. "-" or "") .. phonicity) | ||
elseif syll_count == 3 then --trisyllabic | elseif syll_count == 3 or syll_count >= 5 then -- trisyllabic and polysyllabic (5 or more) | ||
local last_cluster = match(word, "(" .. consonants .. "+)" .. vowels .. "*t?$") | |||
local asematic_endings = { | |||
{ "ng", "n" }, { "[tbnṇmṃd]?[nṇmṃ]", "n" }, | |||
{ "[lḷƛ]", "l" }, | |||
{ "^[rṛ]", "r" }, | |||
{ "^ḍ", "ts" }, { "^tt?[sṡ]", "ts" }, | |||
{ "^[sh]", "s" }, | |||
{ "^[ġḥvį]", "ġ" }, | |||
} | |||
local apocope = args.apo or "t" -- default to -t | |||
if not args.apo then | |||
for _, triggers_result in ipairs(spec) do | |||
local triggers, result = unpack(triggers_result) | |||
if match(last_cluster, triggers) then | |||
apocope = result | |||
end | |||
end | |||
end | |||
return "trisyllabic-" .. ((phonicity == "consonantal" and not args.apo) and phonicity or "apocoptic-" .. apocope) | |||
end | end | ||
end | end | ||
| Line 175: | Line 199: | ||
[1] = {default = pagename, template_default = "goka"}, | [1] = {default = pagename, template_default = "goka"}, | ||
["decl"] = {}, | ["decl"] = {}, | ||
["schiz"] = {}, | ["schiz"] = {type = "boolean"}, | ||
["apo"] = {}, | |||
} | } | ||