I want to process the Japanese dictionary in Lua (for LuaTeX - specific). The dictionary is stored in a text file that must be read. When reading each line of a file, words must correspond to a regular expression (lines are written like this:)
| がくせい | student |:
function readFile(fn)
local file = assert(io.open(fn, "r"))
local contents = file:read("*a")
file:close()
return contents
end
function processTest(contents)
for line in contents:gmatch("%a+") do
print(line)
end
end
a = readFile("vocabulary.org")
processTest(a)
Now the problem is that only English words are printed:
student
I should mention that I am new to Lua and LuaTeX, so if there is a better approach to this, I would be happy to know.
Anyway, is it possible to get Japanese words?
source
share