Module:sw-utilities

local m_links = require("Module:links") local m_head = require("Module:headword")

local lang = require("Module:languages").getByCode("sw")

local export = {}

function export.plural(frame) local word = frame.args[1] local sg_class = frame.args[2]

word = word:gsub("^" .. sg_class .. (sg_class == "m" and "u?" or ""), "")

return word end

function link_words(input_string) local contains_words = false local spacingPunctuation = "([%s%p]+)" local notWordPunc = "([^-־׳״'.·*]+)" local function workaround_to_exclude_chars(s) return mw.ustring.gsub(s, notWordPunc, "]]%1[[") end for possibleWordBreak in mw.ustring.gmatch(input_string, spacingPunctuation) do		if mw.ustring.find(possibleWordBreak, notWordPunc) then contains_words = true break end end if contains_words then return ""				.. mw.ustring.gsub(					input_string,					spacingPunctuation,					workaround_to_exclude_chars					)				.. "" else return input_string end end

function export.verb_headword(frame) local params = { [1] = {},		["head"] = {}, }	local args = require("Module:parameters").process(frame:getParent.args, params) local head = args["head"] or mw.title.getCurrentTitle.text local inf = args[1] or "ku"..head head = '-'..link_words(head) inf = link_words(inf) local data = {lang = lang, pos_category = "verbs", categories = {}, heads = {head}, inflections = }

return m_head.full_headword(data) end

return export