It is a CLI application that parses a JMdict XML and spits out a JSON file.
npm i -g jmdict-parser
JMdict is a Japanese to X (X being English, and a couple of other languages) dictionary whose files are in XML format.
It simply reads the JMdict file into a Javascript object and writes that object into a file.
The JSON file can be read easily for future use, and it is even ~25% smaller than the original XML file!
The JSON file is essentially an array of entry
objects. Here's what one random entry
object looks like:
{
"ent_seq":[
"1002340"
],
"k_ele":[
{
"keb":[
"お早うございます"
],
"ke_pri":[
"spec1"
]
}
],
"r_ele":[
{
"reb":[
"おはようございます"
],
"re_pri":[
"spec1"
]
}
],
"sense":[
{
"pos":[
"∫"
],
"xref":[
"お早おおう"
],
"misc":[
"&uk;",
"&pol;"
],
"s_inf":[
"may be used more generally at any time of day"
],
"gloss":[
"good morning"
]
}
]
}
For more information about the key names read the comments at the start of the original JMdict files.
-
Head over to the JMdict website and download the JMdict dictionary file suitable for you. Also, you would need to extract it as it would be archived.
-
Install the CLI. See here.
-
You may run the it as follows:
jmdict-parser <your_edict_file>
- This would generate a
.json
file in the same location as the original file.
I have already created one for the English only JMdict file. You may download it from here.