# kanjiconv
Japanese REAMED is here. (日本語のREADMEはこちらです。)
https://github.com/sea-turt1e/kanjiconv/blob/main/README_ja.md
![kanjiconv](images/kanjiconv.png)
Kanji Converter to Hiragana, Katakana, Roman alphabet.
You can get the reading and pronunciation of Japanese sentences based on sudachidict.
Sudachidict is a regularly updated dictionary, so it can relatively handle new proper nouns and other terms.
## Environments
```
macOS Sonoma 14.5
python==3.11.7
```
## Install
### Install kanjiconv
```bash
pip install kanjiconv
```
## How to use
### Import & Create Instance
```python
from kanjiconv import KanjiConv
kanji_conv = KanjiConv(separator="/")
```
### Get Reading
```python
# convert to hiragana
text = "幽☆遊☆白書は、最高の漫画デス。"
print(kanji_conv.to_hiragana(text))
ゆうゆうはくしょ/は/、/さいこう/の/まんが/です/。
# convert to katakana
text = "幽☆遊☆白書は、最高の漫画デス。"
print(kanji_conv.to_katakana(text))
ユウユウハクショ/ハ/、/サイコウ/ノ/マンガ/デス/。
# convert to Roman alphabet
text = "幽☆遊☆白書は、最高の漫画デス。"
print(kanji_conv.to_roman(text))
yuuyuuhakusho/ha/, /saikou/no/manga/desu/.
# You can change separator to another character or None
kanji_conv = KanjiConv(separator="_")
print(kanji_conv.to_hiragana(text))
ゆうゆうはくしょ_は_、_さいこう_の_まんが_です_。
kanji_conv = KanjiConv(separator="")
print(kanji_conv.to_hiragana(text))
ゆうゆうはくしょは、さいこうのまんがです。
```
## (Optional) Installing sudachidict other than the default
The default dictionary is sudachidict_full. If you want to use a lighter dictionary, you can install either sudachidict_small or sudachidict_core.
- If you need detailed readings, we recommend using sudachidict_full. The default is set to sudachidict_full.
- If you prefer lighter operation, sudachidict_small is recommended.
- sudachidict_core offers a balanced option between speed and accuracy.
```bash
pip install sudachidict_small
pip install sudachidict_core
```
- If using sudachidict_small or sudachidict_core, specify it like this:
```python
kanji_conv = KanjiConv(sudachi_dict_type="small", separator="/")
kanji_conv = KanjiConv(sudachi_dict_type="core", separator="/")
```
## Update Dict
kanjiconv reading function is based on SudachiDict, and you need to update SudachiDict regularly via pip.
```bash
pip install -U sudachidict_full
pip install -U sudachidict_small
pip install -U sudachidict_core
```
## License
This project is licensed under the [Apache License 2.0](LICENSE).
### Open Source Software Used
- [SudachiPy](https://github.com/WorksApplications/SudachiPy): Apache License 2.0
- [SudachiDict](https://github.com/WorksApplications/SudachiDict): Apache License 2.0
This library uses SudachiPy and its dictionary SudachiDict for morphological analysis. These are also distributed under the Apache License 2.0.
For detailed license information, please refer to the LICENSE files of each project:
- [SudachiPy LICENSE](https://github.com/WorksApplications/SudachiPy/blob/develop/LICENSE)
- [SudachiDict LICENSE](https://github.com/WorksApplications/SudachiDict/blob/develop/LICENSE-2.0.txt)
Raw data
{
"_id": null,
"home_page": "https://github.com/sea-turt1e/kanjiconv",
"name": "kanjiconv",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": "kanji, kana, converter, sudachi, propernoun",
"author": "sea-turt1e",
"author_email": "h.yamada.bg@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f7/7a/ed5c47481e48d35aace198106970814b86363973e3068d300d66d620e3c1/kanjiconv-0.1.2.tar.gz",
"platform": null,
"description": "# kanjiconv\nJapanese REAMED is here. \uff08\u65e5\u672c\u8a9e\u306eREADME\u306f\u3053\u3061\u3089\u3067\u3059\u3002\uff09 \nhttps://github.com/sea-turt1e/kanjiconv/blob/main/README_ja.md\n\n![kanjiconv](images/kanjiconv.png)\n\nKanji Converter to Hiragana, Katakana, Roman alphabet. \nYou can get the reading and pronunciation of Japanese sentences based on sudachidict. \nSudachidict is a regularly updated dictionary, so it can relatively handle new proper nouns and other terms.\n\n## Environments\n```\nmacOS Sonoma 14.5\npython==3.11.7\n```\n\n## Install\n### Install kanjiconv\n```bash\npip install kanjiconv\n```\n\n## How to use\n### Import & Create Instance\n```python\nfrom kanjiconv import KanjiConv\nkanji_conv = KanjiConv(separator=\"/\")\n```\n\n### Get Reading\n```python\n# convert to hiragana\ntext = \"\u5e7d\u2606\u904a\u2606\u767d\u66f8\u306f\u3001\u6700\u9ad8\u306e\u6f2b\u753b\u30c7\u30b9\u3002\"\nprint(kanji_conv.to_hiragana(text))\n\u3086\u3046\u3086\u3046\u306f\u304f\u3057\u3087/\u306f/\u3001/\u3055\u3044\u3053\u3046/\u306e/\u307e\u3093\u304c/\u3067\u3059/\u3002\n\n# convert to katakana\ntext = \"\u5e7d\u2606\u904a\u2606\u767d\u66f8\u306f\u3001\u6700\u9ad8\u306e\u6f2b\u753b\u30c7\u30b9\u3002\"\nprint(kanji_conv.to_katakana(text))\n\u30e6\u30a6\u30e6\u30a6\u30cf\u30af\u30b7\u30e7/\u30cf/\u3001/\u30b5\u30a4\u30b3\u30a6/\u30ce/\u30de\u30f3\u30ac/\u30c7\u30b9/\u3002\n\n# convert to Roman alphabet\ntext = \"\u5e7d\u2606\u904a\u2606\u767d\u66f8\u306f\u3001\u6700\u9ad8\u306e\u6f2b\u753b\u30c7\u30b9\u3002\"\nprint(kanji_conv.to_roman(text))\nyuuyuuhakusho/ha/, /saikou/no/manga/desu/. \n\n# You can change separator to another character or None\nkanji_conv = KanjiConv(separator=\"_\")\nprint(kanji_conv.to_hiragana(text))\n\u3086\u3046\u3086\u3046\u306f\u304f\u3057\u3087_\u306f_\u3001_\u3055\u3044\u3053\u3046_\u306e_\u307e\u3093\u304c_\u3067\u3059_\u3002\n\nkanji_conv = KanjiConv(separator=\"\")\nprint(kanji_conv.to_hiragana(text))\n\u3086\u3046\u3086\u3046\u306f\u304f\u3057\u3087\u306f\u3001\u3055\u3044\u3053\u3046\u306e\u307e\u3093\u304c\u3067\u3059\u3002\n```\n\n## (Optional) Installing sudachidict other than the default\nThe default dictionary is sudachidict_full. If you want to use a lighter dictionary, you can install either sudachidict_small or sudachidict_core.\n- If you need detailed readings, we recommend using sudachidict_full. The default is set to sudachidict_full.\n- If you prefer lighter operation, sudachidict_small is recommended.\n- sudachidict_core offers a balanced option between speed and accuracy.\n```bash\npip install sudachidict_small\npip install sudachidict_core\n```\n- If using sudachidict_small or sudachidict_core, specify it like this:\n```python\nkanji_conv = KanjiConv(sudachi_dict_type=\"small\", separator=\"/\")\nkanji_conv = KanjiConv(sudachi_dict_type=\"core\", separator=\"/\")\n```\n\n## Update Dict\nkanjiconv reading function is based on SudachiDict, and you need to update SudachiDict regularly via pip.\n```bash\npip install -U sudachidict_full\npip install -U sudachidict_small\npip install -U sudachidict_core\n```\n\n## License\n\nThis project is licensed under the [Apache License 2.0](LICENSE).\n\n### Open Source Software Used\n\n- [SudachiPy](https://github.com/WorksApplications/SudachiPy): Apache License 2.0\n- [SudachiDict](https://github.com/WorksApplications/SudachiDict): Apache License 2.0\n\nThis library uses SudachiPy and its dictionary SudachiDict for morphological analysis. These are also distributed under the Apache License 2.0.\n\nFor detailed license information, please refer to the LICENSE files of each project:\n\n- [SudachiPy LICENSE](https://github.com/WorksApplications/SudachiPy/blob/develop/LICENSE)\n- [SudachiDict LICENSE](https://github.com/WorksApplications/SudachiDict/blob/develop/LICENSE-2.0.txt)\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Kanji Converter to Hiragana, Katakana, Roman alphabet",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/sea-turt1e/kanjiconv",
"Repository": "https://github.com/sea-turt1e/kanjiconv"
},
"split_keywords": [
"kanji",
" kana",
" converter",
" sudachi",
" propernoun"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d5499acd0a006c50aefb3e87eec435af271155767866d9c627afbb9be057414d",
"md5": "6e86bd9121511d680bbc630da4793f2e",
"sha256": "762a7ca8604a1c654d905238ea4b3e5e757cb88747db942b15fabd88e67720f7"
},
"downloads": -1,
"filename": "kanjiconv-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6e86bd9121511d680bbc630da4793f2e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 9521,
"upload_time": "2024-11-13T03:25:23",
"upload_time_iso_8601": "2024-11-13T03:25:23.619949Z",
"url": "https://files.pythonhosted.org/packages/d5/49/9acd0a006c50aefb3e87eec435af271155767866d9c627afbb9be057414d/kanjiconv-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f77aed5c47481e48d35aace198106970814b86363973e3068d300d66d620e3c1",
"md5": "9d40488407474e172408f99f500f2834",
"sha256": "8611ac13c27693d0df6294fd01b0a10166d8ec41a7e2bcd1e2860b83c12dede1"
},
"downloads": -1,
"filename": "kanjiconv-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "9d40488407474e172408f99f500f2834",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 8403,
"upload_time": "2024-11-13T03:25:25",
"upload_time_iso_8601": "2024-11-13T03:25:25.093528Z",
"url": "https://files.pythonhosted.org/packages/f7/7a/ed5c47481e48d35aace198106970814b86363973e3068d300d66d620e3c1/kanjiconv-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-13 03:25:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sea-turt1e",
"github_project": "kanjiconv",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "kanjiconv"
}