I want to create a command in LaTeX, like this:
\chinese{炒面}
And have it create a footnote with the definition given from the CC-EDICT dictionary.
炒麵 炒面 [chao3 mian4] /stir-fried noodles/"chow mein"/
The CC-EDICT dictionary...
The dictionary is a downloadable text file, with ~118,000 lines like
...
炒雞蛋 炒鸡蛋 [chao3 ji1 dan4] /scrambled eggs/
炒飯 炒饭 [chao3 fan4] /fried rice/(slang) (Tw) to have sex/
炒魷魚 炒鱿鱼 [chao3 you2 yu2] /(coll.) to fire sb/to sack sb/
炒麵 炒面 [chao3 mian4] /stir-fried noodles/"chow mein"/
...
The first word is the traditional Chinese, the second is the simplified Chinese. In brackets is the pronunciation. And between the slashes is the definition.
I tried \usepackage{datatool}
, and it could manage the first 1000 lines or so, but nothing in the ballpark of ~118,000 lines. It seems it tries to load the whole file into memory.
Using grep
I could use grep " 炒面 " cedict_ts.u8
to get the appropriate line(s) for simplified Chinese, but I don't know how to do this in LaTeX.
Multiple definitions...
Sometimes there are multiple definitions:
得 得 [de2] /to obtain/to get/to gain/to catch (a disease)/proper/suitable/proud/contented/to allow/to permit/ready/finished/
得 得 [de5] /structural particle: used after a verb (or adjective as main verb), linking it to following phrase indicating effect, degree, possibility etc/
得 得 [dei3] /to have to/must/ought to/to need to/
Ideally these would be all included, and separated in some way.
Question: How do I extract the definition(s) of a Chinese word from the CC-EDICT dictionary?
grep
process) and then using it with Lua(La)Tex.