Module:siwa-pron: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
local m_data = mw.loadData('Module:siwa-pron/data')
local m_data = mw.loadData('Module:siwa-pron/data')


--local internal_clusters = m_data.internal_clusters_2 .. m_data.internal_clusters_3 .. m_data.internal_clusters_4 .. m_data.internal_clusters_5
 


local rules = {
local rules = {
Line 20: Line 20:
}
}


local consonants = "|m|p|b|v|n|t|d|s|ṡ|r|k|g|ġ|h|į|ų"
local initial = table.concat(m_data.initial_clusters, "|") .. consonants
local internal = table.concat(m_data.internal_clusters, "|") .. consonants
local vocalic = "a|e|i|o|u|y|ả|ẻ|ỉ|ỏ|ủ|ỷ|ů|õ|ę|" .. table.concat(m_data.diphthongs, "|") .. table.concat(m_data.triphthongs, "|")


 
function export.syllable(frame)
function export.separateSyllables(frame)
local word = mw.title.getCurrentTitle().text
local syllables = {}
local pattern = "^(" .. initial .. ")?(" .. vocalic .. ")?(" .. internal .. ")?"
local pattern = "(s)?(aeiou){1}"
return m_su.capturing_split(word, pattern)
table.insert(syllables, m_su.capturing_split(mw.title.getCurrentTitle().text, pattern))
return syllables
end
end


function export.show(frame)
function export.show(frame)
local parent_args = frame:getParent().args
local parent_args = frame:getParent().args
local params = {
local params = {
[1] = { default = mw.title.getCurrentTitle().text},
[1] = { default = mw.title.getCurrentTitle().text },
}
}
local args = require("Module:parameters").process(parent_args, params)
local args = require("Module:parameters").process(parent_args, params)


local IPA_key = "IPA for Siwa"
local IPA_key = "IPA for Siwa"
local key_link = "[["..IPA_key.."|key]]"
local key_link = "[[".. IPA_key .."|key]]"


local prefix = "[[w:IPA chart|IPA]]<sup>(" .. key_link .. ")</sup>:&#32;"
local prefix = "[[w:IPA chart|IPA]]<sup>(" .. key_link .. ")</sup>:&#32;"

Revision as of 23:09, 25 December 2020



local export = {}
	
local m_IPA = require("Module:IPA")
local m_su = require("Module:string utilities")
local m_table = require("Module:table")
local m_data = mw.loadData('Module:siwa-pron/data')



local rules = {
	{"ẻu", "øː"},
	{"õu", "ɔ̃ː"},
	{"ả", "æː"},
	{"ẻ", "eː"},
	{"ỉ", "iː"},
	{"ỏ", "ʊː"},
	{"ủ", "uː"},
	{"ỷ", "yː"},
	
}

local consonants = "|m|p|b|v|n|t|d|s|ṡ|r|k|g|ġ|h|į|ų"
local initial = table.concat(m_data.initial_clusters, "|") .. consonants
local internal = table.concat(m_data.internal_clusters, "|") .. consonants
local vocalic = "a|e|i|o|u|y|ả|ẻ|ỉ|ỏ|ủ|ỷ|ů|õ|ę|" .. table.concat(m_data.diphthongs, "|") .. table.concat(m_data.triphthongs, "|")

function export.syllable(frame)
	local word = mw.title.getCurrentTitle().text
	local pattern = "^(" .. initial .. ")?(" .. vocalic .. ")?(" .. internal .. ")?"
	return m_su.capturing_split(word, pattern)
end

function export.show(frame)
	local parent_args = frame:getParent().args
	local params = {
		[1] = { default = mw.title.getCurrentTitle().text },
	}
	local args = require("Module:parameters").process(parent_args, params)

	local IPA_key = "IPA for Siwa"
	local key_link = "[[".. IPA_key .."|key]]"

	local prefix = "[[w:IPA chart|IPA]]<sup>(" .. key_link .. ")</sup>:&#32;"
	local accent="(\''Aingo\'') "
	
	trans = "<span style=\"font-size:110%;font-family:Gentium,'DejaVu Sans','Segoe UI',sans-serif>[" .. args[1] .. "]</span>"

	out = accent..prefix..trans
	
	return out
end

return export