Converts a set of Wiktionary entries into a MOBI dictionary usable by a Kindle.
- A Wiktionary dump is downloaded.
- JWKTL is used to parse the downloaded XML and to create a database of the results.
- Some Java code iterates on the wanted entries and generates a text file in which each line has the following format:
word<TAB>definition
. - tab2opf is used to convert the text file into a set of OPF and HTML files.
- KindleGen is used to convert the above OPF and HTML files to a MOBI eBook that can be used as a dictionary by a Kindle.
- International Digital Publishing Forum
- EPUB 2 standard
- EPUB 3 standard
- EPUB Dictionaries and Glossaries 1.0
- EPUB – Wikipedia
- Creating Dictionaries – Kindle Publishing Guidelines
git clone https://github.com/nyg/wiktionary-to-kindle.git
git submodule update --init --recursive
Apache Maven is required.
mvn package
Download the latest English Wiktionary dump. In the following command, the en
and latest
arguments are the defaults so they are not needed. Note that the specified language should be parsable by JWKTL (currently it only supports en
, de
, ru
). To specify another date use the YYYYMMDD
format. The dump downloaded is pages-articles.xml.bz2
.
java -jar target/wiktionary-to-kindle-1.0.0.jar download en latest
The dump must now be parsed using the following command (as mentioned above, en
and latest
are not needed).
java -jar target/wiktionary-to-kindle-1.0.0.jar parse en latest
Time has now come to generate the dictionary text file. As said before, the default language is en
but here it is possible to select only the entries of a particular language. For example, if we want only the Greek entries (el
) of the English Wiktionary, the following command is to be used:
java -jar target/wiktionary-to-kindle-1.0.0.jar generate el
The dictionary file has been generated in dictionaries/lexicon.txt
. To convert it into an OPF file, execute the commands below. Python 3 is required. The -s
and -t
options are the source and target languages respectively.
cd dictionaries
python ../scripts/tab2opf/tab2opf.py -s el -t en -o "Greek–English Dictionary" lexicon.txt
Convert the OPF file into a MOBI eBook using KindleGen.
# Linux
../scripts/kindlegen_linux/kindlegen dictionary-el-en.opf
# macOS
../scripts/kindlegen_mac/kindlegen dictionary-el-en.opf
# Windows
..\scriptgs\kindlegen_windows\kindlegen.exe dictionary-el-en.opf
If all went well, you should now have the dictionary-el-en.mobi
file in your possession. You can either send it to your Kindle via its Kindle email address, or drag and drop it as you would with another eBook.
- Rewrite tab2opf in Java (?)
- tab2opf should output EPUB v2 or v3 if supported by kindlegen
- Finding how to properly structure the OPF entries (inflected terms, etc.).
- Convert Wiktionary templates into HTML or find a HTML Wiktionary dump
- Improving JWKTL's parsing abilities (template support, etc.).