Skip to main content

A Python script to adding/removing furigana for Japanese epub books.

Project description

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.

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

furigana4epub-1.0.2.tar.gz (7.7 kB view hashes)

Uploaded Source

Built Distribution

furigana4epub-1.0.2-py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page