local export = {}

-- FIXME! We should convert the existing headword templates into module code.
local force_cat = false -- enable for testing

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

function export.categorize_phrasal_verb(frame)
	local particle = frame.args[1]
	particle = mw.text.trim(particle)
	-- Don't add categories if the particle is just "sig" (reflexive), and remove "sig" from particles that
	-- include it along with another word.
	if particle == "sig" then
		return
	end
	particle = particle:gsub(" +sig%f[%W]", ""):gsub("%f[%w]sig +", "")
	local categories = {"Swedish phrasal verbs", ('Swedish phrasal verbs formed with "%s"'):format(particle)}
	return require("Module:utilities").format_categories(categories, lang, nil, nil, force_cat)
end

return export