Module:th-hom

Hello, you have come here looking for the meaning of the word Module:th-hom. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:th-hom, but we will also tell you about its etymology, its characteristics and you will know how to say Module:th-hom in singular and plural. Everything you need to know about the word Module:th-hom you have here. The definition of the word Module:th-hom will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:th-hom, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}
local lang = require("Module:languages").getByCode("th")
local PAGENAME = mw.title.getCurrentTitle().text

local function getHomophones(reading)
	
	return require('Module:th-hom/data') or {}
	
end

-- can be called from another module
function export.makeList(reading)
	
	local result = {}
	local categories = {}
	
	local homList = getHomophones(reading)
	if #homList > 1 then
		for _,term in ipairs(homList) do
			-- skip if same word
			if term ~= PAGENAME then
				table.insert(result, require('Module:links').full_link({lang = lang, term = term, tr = '-'}))
			end
		end
		if mw.title.getCurrentTitle().namespace == 0 then
			table.insert(categories, "Thai terms with homophones")
		end
	end
	
	return table.concat(result, ', ')
		.. require('Module:utilities').format_categories(categories, lang)
	
end

function export.show(frame)
	
	local args = frame:getParent().args
	local reading = args or PAGENAME
	local output = export.makeList(reading)
	
	if output ~= '' then
		output = 'Homophones: ' .. output
	end
	return output
	
end

return export