Jinf: Japanese Inflection Converter
Jinf is a Japanese inflection converter. Jinf depends on JumanDic and follows the grammar.
Installation
pip install jinf
Usage
from jinf import Jinf
jinf = Jinf()
text = "走る"
inf_type = "子音動詞ラ行"
source_inf_form = "基本形"
print(jinf(text, inf_type, source_inf_form, "基本形")) # 走る
print(jinf(text, inf_type, source_inf_form, "未然形")) # 走ら
print(jinf(text, inf_type, source_inf_form, "意志形")) # 走ろう
print(jinf(text, inf_type, source_inf_form, "命令形")) # 走れ
print(jinf(text, inf_type, source_inf_form, "三角形")) # ValueError: '三角形' is not a valid inflection form of '子音動詞ラ行'
print(jinf(text, inf_type, source_inf_form, "デアル列命令形")) # ValueError: 'デアル列命令形' is not a valid inflection form of '子音動詞ラ行'
pyknp integration
pyknp is the official Python binding for Jumanpp. To enable the pyknp integration, specify the extra requirement when installing Jinf:
pip install jinf[pyknp]
Morpheme objects can be used as input for Jinf as follows.
from jinf import Jinf
from pyknp import Morpheme
jinf = Jinf()
mrph = Morpheme('走る はしる 走る 動詞 2 * 0 子音動詞ラ行 10 基本形 2 "代表表記:走る/はしる"')
print(jinf.convert_pyknp_morpheme(mrph, "基本形")) # 走る
print(jinf.convert_pyknp_morpheme(mrph, "未然形")) # 走ら
print(jinf.convert_pyknp_morpheme(mrph, "意志形")) # 走ろう
print(jinf.convert_pyknp_morpheme(mrph, "命令形")) # 走れ
print(jinf.convert_pyknp_morpheme(mrph, "三角形")) # ValueError: '三角形' is not a valid inflection form of '子音動詞ラ行'
print(jinf.convert_pyknp_morpheme(mrph, "デアル列命令形")) # ValueError: 'デアル列命令形' is not a valid inflection form of '子音動詞ラ行'
List of available inflection types/forms
See JUMAN.katuyou in JumanDic.
Metadata
Release files for jinf 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jinf-1.0.4.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jinf-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.4 kB
Release files / jinf-1.0.4.tar.gz
| Download URL | jinf-1.0.4.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
749982c729a76ea73a075edb1fc9226c81f676b549497f9cb935898ae08f6495
|
|
BLAKE2b-256 checksum How to use checksums |
091b810b0ba0175e0e90cda15aa020fac12330feeea60461440fea41c1147920
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.14 CPython/3.10.5 Darwin/21.6.0
|
Release files / jinf-1.0.4-py3-none-any.whl
| Download URL | jinf-1.0.4-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e35bef8efb476c78a2d6d9bb3c60f722cdf5f0df4d7642b19b46b8cc10f8f23f
|
|
BLAKE2b-256 checksum How to use checksums |
c4eff8c89db1db4541139e7f72d14153265a39e33078290612399e4cbef9a45d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.14 CPython/3.10.5 Darwin/21.6.0
|