Skip to main content

用于为日本 epub 书籍添加/删除注音假名的 Python 脚本。

项目描述

frigana4epub

一个 Python 脚本,用于为日本 epub 书籍添加/删除假名。使用 Mecab 和 Unidic。

ある日の放课后だった。

ある<ruby>日<rp>(</rp><rt>ひ</rt><rp>)</rp></ruby>の<ruby>放课<rp>(</rp><rt>ほうか</rt><rp>)</rp>后<rp>(</rp><rt>ご</rt><rp>)</rp></ruby>だった。

应该使用 Python3.6 或更高版本,但仅使用 Python 3.7.5 进行测试

安装

pip install furigana4epub

如果您想使用完整版的 UniDic,请阅读这篇文章

用法

要添加假名:
furigana4epub target.epub

要删除假名:
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.

Kindle 的注意事项

如果您使用Calibre进行电子书转换,请选择 azw3(KF8) 输出格式。
Calibre 的 mobi 输出格式不支持<ruby>标签。

学分

这个脚本的灵感来自WebNovelCrawlerpinyin2epub ,其中有一些代码。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

furigana4epub-1.0.2.tar.gz (7.7 kB 查看哈希

已上传 source

内置分布

furigana4epub-1.0.2-py3-none-any.whl (8.1 kB 查看哈希

已上传 py3