yakinori
Japanese REAMED is here.
https://github.com/morikatron/yakinori/blob/main/README_ja.md
Japanese Converter Kanji to Hiragana, Katakana, Latin alphabet.
You can get the reading and pronunciation of Japanese sentences based on mecab-unidic-NEologd.
Test Environments
Ubuntu18.04
python==3.8.16
Install
There are two options to install.
- Install Mecab and mecab-unidic-NEologd in your own environment
- Use Docker
Your Own Environment
For Ubuntu
Install Mecab
$ sudo apt update
$ sudo apt install mecab libmecab-dev mecab-ipadic-utf8
Install mecab-unidic-NEologd
$ git clone --depth 1 https://github.com/neologd/mecab-unidic-neologd.git
$ cd mecab-unidic-neologd
$ sudo ./bin/install-mecab-unidic-neologd -n -y
# show installed mecab-unidic-NEologd dictionary path
$ echo `mecab-config --dicdir`"/mecab-unidic-neologd"
> /usr/local/lib/mecab/dic/mecab-unidic-neologd
# If you want to make mecab-unidic-NEologd as defalut dictionary, run commands below.
$ echo "dicdir = `mecab-config --dicdir`/mecab-unidic-neologd" | sudo tee /etc/mecabrc
$ sudo cp /etc/mecabrc /usr/local/etc
Install yakinori
$ pip install yakinori
You can update the recent mecab-unidic-NEologd
$ sudo ./bin/install-mecab-unidic-neologd -n -y
$ echo "dicdir = `mecab-config --dicdir`/mecab-unidic-neologd" | sudo tee /etc/mecabrc
$ sudo cp /etc/mecabrc /usr/local/etc
Use Docker
$ docker pull morikayamada/yakinori
How to use
Import
>>> from yakinori import Yakinori
create Instance
Installed on your Own Environment
- If you made mecab-unidic-NEologd as defalut dictionary, you don't need to add dic_path.
>>> yakinori = Yakinori()
- If you did not make mecab-unidic-NEologd as defalut dictionary, add dic_path.
>>> yakinori = Yakinori(dic_path='path/to/mecab-unidic-NEologd')
Using Docker
If you use Docker, you don't need to add dic_path.
>>> yakinori = Yakinori()
Parse Sentence
>>> sentence = "幽☆遊☆白書は最高の漫画です"
>>> parsed_list = yakinori.get_parsed_list(sentence)
Get Reading
# convert to hiragana
>>> hiragana_sentence = yakinori.get_hiragana_sentence(parsed_list)
>>> print(hiragana_sentence)
ゆうゆうはくしょはさいこうのまんがです
# convert to katakana
>>> katakana_sentence = yakinori.get_katakana_sentence(parsed_list)
>>> print(katakana_sentence)
ユウユウハクショハサイコウノマンガデス
# convert to Latin alphabet
>>> roma_sentence = yakinori.get_roma_sentence(parsed_list)
>>> print(roma_sentence)
yuuyuuhakushohasaikounomangadesu
Get Pronunciation
# convert to hiragana
>>> hiragana_sentence = yakinori.get_hiragana_sentence(parsed_list, is_hatsuon=True)
>>> print(hiragana_sentence)
ゆーゆーはくしょわさいこーのまんがです
# convert to katakana
>>> katakana_sentence = yakinori.get_katakana_sentence(parsed_list, is_hatsuon=True)
>>> print(katakana_sentence)
ユーユーハクショワサイコーノマンガデス
# convert to Latin alphabet
>>> roma_sentence = yakinori.get_roma_sentence(parsed_list, is_hatsuon=True)
>>> print(roma_sentence)
yuーyuーhakushowasaikoーnomangadesu
Metadata
Release files for yakinori 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yakinori-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / yakinori-0.1.2-py3-none-any.whl
| Download URL | yakinori-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10884588ed78d3a8ec073d61680dde6a21837a446a71049916b62fb206d9b269
|
|
BLAKE2b-256 checksum How to use checksums |
0c64d7a3ae2d99741c0fda6605f4897ab2806065114b35635bc63bcdafe76b67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Security for yakinori 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.