A utility to extract vocabulary lists from manga.
Project description
Japanese Vocabulary Extractor
This script allows you to automatically scan through various types of japanese media (currently manga and ebooks) and generate a csv with all contained words. It also allows you to automatically add the english definitions to the CSV.
The resulting csv can be imported to Anki (if you add the english definitions) or Bunpro.
Installation
You need to have python installed (ideally Python 3.12).
Install the package using
pip install japanese-vocabulary-extractor
Usage
jpvocab-extractor [-h] [--parent] [--add-english] --type TYPE input_path
Specify the type of media: 'manga', 'pdf', 'epub' or 'text'. Replace input_path with the path containing the files (or, if not a manga, the file directly). Make sure to surround it with quotation marks if there are spaces in the path!
This will generate a vocab.csv file containing all words. If you wish to add definitions in the secon column of the CSV, add the "--add-english" argument.
Only for manga: If you enter a parent folder containing multiple volumes in their own folders, add "--parent" before the type.
Bonus: Since this script is using mokuro, you'll also generate a .mokuro and .html file for each volume, allowing you to read the manga with selectable text in your browser. For more info, visit the mokuro github page linked at the bottom.
Notices
If you run into errors, look into the mokuro repository linked at the bottom. There might be some issues with python version compatibility.
Also important: This script is not perfect. The text recognition can make mistakes and some of the extracted vocab can be wrong. If this proves to be a big issue I will look for a different method to parse vocabulary from the text.
TODO
- Live Output from Mokuro (it can take very long)
- Separate outputs for each volume
- More advanced dictionary lookup functionality
- Support more input formats (please suggest any you might want!)
- Support other output formats
Acknowledgements
This is hardly my work, I just stringed together some amazing libraries:
- mokuro, to extract lines of text from manga - https://github.com/kha-white/mokuro
- mecab-python3, to tokenize japanese text and extract the dictionary forms - https://github.com/SamuraiT/mecab-python3
- unidic_lite, for data necessary for mecab to work - https://github.com/polm/unidic-lite
- jisho.org, for their API to look up words - https://jisho.org
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file japanese_vocabulary_extractor-0.4.0.tar.gz
.
File metadata
- Download URL: japanese_vocabulary_extractor-0.4.0.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dc3e707e40cbf7f262f4805affec0298d6514ecd0e3a62c87650c957d467fe1 |
|
MD5 | c35295d59bf289d93790413b84903bd1 |
|
BLAKE2b-256 | 77b1f0adaf6ea0de178ce48906cc0d3c59b6bb5be7dbc923556ed90181071ce6 |
File details
Details for the file japanese_vocabulary_extractor-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: japanese_vocabulary_extractor-0.4.0-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2562827585287bd83ee4206f365a70ca9681c585c6f72377f293d3cb9b5767f6 |
|
MD5 | 15b4649aa2291d63cc197e326bbbc68e |
|
BLAKE2b-256 | 849b1ef2ea228fca3aae0c7862815a3ff754cc5b6a76dc666a7bcafba0c125ea |