A Japanese inflections tool
Project description
PyKatsuyou
A Japanese verb/adjective inflections tool for python.
PyKatsuyou uses these great packages:
- igo-python (detecting verbs and adjectives)
- jaconv (convert katakana --> hiragana)
- tabulate (print a table)
Install
pip install pykatsuyou
Usage
This tool requires that you input the dictionary form of the verb/adjective. Using only hiragana may have strange results (unless it's an irregular verb).
from tabulate import tabulate
from pykatsuyou import getInflections
from igo.tagger import Tagger
tt = Tagger() # Optional
data = getInflections('する', jsonIndent=2, tt=tt)
print(data['json'])
print(data['list'])
table = getInflections('行く', dataframe=True)
print(tabulate(table, headers='keys', tablefmt='pretty'))
CLI
pykatsuyou する
pykatsuyou -h
Usage:
pykatsuyou [verb/adjective] [-h/-j/-l]
*Must use dictionary form
Options:
***A table is printed by default***
-h (--help) = outputs this text
-j (--json) = prints json
-l (--list) = prints a list
Output - 行く
Object
{
# json contains a json string
'json': '{
"Affirmative": {
"Dict-Form": "行く",
"Non-Past Polite": "行きます",
"Past": "行った",
"Past Polite": "行きました",
"Te-Form": "行って",
"Imperative": "行け",
"Conditional": "行けば",
"Volitional": "行こう"
},
"Negative": {
"Dict-Form": "行かない",
"Non-Past Polite": "行きません",
"Past": "行かなかった",
"Past Polite": "行きませんでした",
"Te-Form": "行かなくて",
"Imperative": "行くな",
"Conditional": "行かなければ",
"Volitional": "x"
}
}',
'list': [
'行きます',
'行った',
'行きました',
'行って',
'行け',
'行けば',
'行こう',
'行きません',
'行かなかった',
'行きませんでした',
'行かなくて',
'行くな',
'行かなければ'
]
}
Table
Godan Verb | Affirmative | Negative |
---|---|---|
Dict-Form | 行く | 行かない |
Non-Past Polite | 行きます | 行きません |
Past | 行った | 行かなかった |
Past Polite | 行きました | 行きませんでした |
Te-Form | 行って | 行かなくて |
Imperative | 行け | 行くな |
Conditional | 行けば | 行かなければ |
Volitional | 行こう | x |
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
PyKatsuyou-1.1.1.tar.gz
(8.2 kB
view details)
Built Distribution
File details
Details for the file PyKatsuyou-1.1.1.tar.gz
.
File metadata
- Download URL: PyKatsuyou-1.1.1.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9bc132037bb80e27fa5cc75a64066b8369a6bba8080f5077c68fc2d0077f562 |
|
MD5 | 4122f7a48de132f48ff0c5d5ef86768e |
|
BLAKE2b-256 | 913c45ab2618feca7b194d1689d25c70efe97690662a9cc9dc46dc7cc613493f |
File details
Details for the file PyKatsuyou-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: PyKatsuyou-1.1.1-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2452b9f728f6918d4e7cd1f36d75ceedbf45ec11c17901cde34ff76b95990efd |
|
MD5 | 0fe193eda3866e080b3cacd0e8d34050 |
|
BLAKE2b-256 | 181a42d05b1e1ac44f8290f6b19344fa6f191b1e4d86131a08137023744fe8cf |