local export = {}
function export.get_all()
local ret = {}
for i=0,196 do --196 is the limit
success, data = pcall(mw.loadData,('Module:zh/data/yue-word/%03d'):format(i))
if success then
for key,val in pairs(data) do
ret = {}
val = mw.ustring.gsub(val,", ",",")
for pron in mw.text.gsplit(val,",",true) do
pron = mw.ustring.gsub(pron,",",", ")
table.insert(ret,pron)
end
end
end
end
return ret
end
function export.get_all_reverse()
local ret = {}
for i=0,196 do --196 is the limit
success, data = pcall(mw.loadData,('Module:zh/data/Jyutping_word/%03d'):format(i))
if success then
for key,val in pairs(data) do
val = mw.ustring.gsub(val,", ",",")
for pron in mw.text.gsplit(val,",",true) do
pron = mw.ustring.gsub(pron,",",", ")
if ret then
table.insert(ret,key)
else
ret = {key}
end
end
end
end
end
return ret
end
function export.get_homophones()
local ret = export.get_all_reverse()
for key,val in pairs(ret) do
if #val == 1 then
ret = nil
end
end
return ret
end
return export