Module:zh/data/yue-word
Appearance
- The following documentation is located at Module:zh/data/yue-word/documentation. [edit] Categories were auto-generated by Module:documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
- 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/documentation
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