- Zh/data/yue-word
- Zh/data/yue-word/000
- Zh/data/yue-word/012
- Zh/data/yue-word/013
- Zh/data/yue-word/014
- Zh/data/yue-word/015
- Zh/data/yue-word/016
- Zh/data/yue-word/017
- Zh/data/yue-word/018
- Zh/data/yue-word/019
- Zh/data/yue-word/020
- Zh/data/yue-word/021
- Zh/data/yue-word/022
- Zh/data/yue-word/023
- Zh/data/yue-word/024
- Zh/data/yue-word/025
- Zh/data/yue-word/026
- Zh/data/yue-word/027
- Zh/data/yue-word/028
- Zh/data/yue-word/029
- Zh/data/yue-word/030
- Zh/data/yue-word/031
- Zh/data/yue-word/032
- Zh/data/yue-word/033
- Zh/data/yue-word/034
- Zh/data/yue-word/035
- Zh/data/yue-word/036
- Zh/data/yue-word/037
- Zh/data/yue-word/038
- Zh/data/yue-word/039
- Zh/data/yue-word/040
- Zh/data/yue-word/062
- Zh/data/yue-word/063
- Zh/data/yue-word/131
- Zh/data/yue-word/134
- Zh/data/yue-word/135
- Zh/data/yue-word/141
- Zh/data/yue-word/142
- Zh/data/yue-word/143
- Zh/data/yue-word/146
- Zh/data/yue-word/148
- Zh/data/yue-word/150
- Zh/data/yue-word/151
- Zh/data/yue-word/152
- Zh/data/yue-word/157
- Zh/data/yue-word/158
- Zh/data/yue-word/162
- Zh/data/yue-word/163
- Zh/data/yue-word/164
- Zh/data/yue-word/167
- Zh/data/yue-word/169
- Zh/data/yue-word/170
- Zh/data/yue-word/doc
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[key] = {}
val = mw.ustring.gsub(val,", ",",")
for pron in mw.text.gsplit(val,",",true) do
pron = mw.ustring.gsub(pron,",",", ")
table.insert(ret[key],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[pron] then
table.insert(ret[pron],key)
else
ret[pron] = {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[key] = nil
end
end
return ret
end
return export