Skip to content

A Python script for adding furigana to Japanese epub books using Mecab and Unidic.

License

Notifications You must be signed in to change notification settings

Mumumu4/furigana4epub

Repository files navigation

furigana4epub

A Python script to add/remove furigana for Japanese epub books. Using Mecab and Unidic.

ある日の放課後だった。

ある()放課(ほうか)()だった。

Should work with Python3.6 or higher, but only tested with Python 3.7.5

Install

pip install furigana4epub

If you want to use the full version of UniDic, read this article.

Usage

To add furigana:
furigana4epub target.epub

To remove furigana:
furigana4epub -d target.epub

furigana4epub -h
usage: furigana4epub [-h] [-e EXTENSION] [-r] [-s SUFFIX] [-d] [-b] [-p]
                        paths [paths ...]

A Python script to add/remove furigana for Japanese epub books. Using Mecab
and Unidic.

positional arguments:
  paths                 Paths of Japanese epub books,can be file names or file
                        folders

optional arguments:
  -h, --help            show this help message and exit
  -e EXTENSION, --extension EXTENSION
                        File extension to filter by(default:.epub)
  -r, --recursive       Search through subfolders
  -s SUFFIX, --suffix SUFFIX
                        suffix of the converted file(default:"_furigana" for
                        adding or "_no_furigana" for removing furiganas)
  -d, --remove          remove furigana from epub file
  -b, --blod            Covert <ruby> dot to html <b> tag before adding
                        furigana
  -p, --rp              Do not add ruby <rp> tag to provide fall-back
                        parentheses for browsers that do not support display
                        of ruby annotations.Result a smaller output but with
                        less compatibility.

A note for Kindle

If you are using Calibre for ebook conversion, choose azw3(KF8) output format.
Calibre's mobi output format wouldn't support <ruby> tag.

Credits

This script is inspired by WebNovelCrawler, pinyin2epub ,have some codes from them.

About

A Python script for adding furigana to Japanese epub books using Mecab and Unidic.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages