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": "ο½"
}
}',
'list': [
'θ‘γγΎγ',
'θ‘γ£γ',
'θ‘γγΎγγ',
'θ‘γ£γ¦',
'θ‘γ',
'θ‘γγ°',
'θ‘γγ',
'θ‘γγΎγγ',
'θ‘γγͺγγ£γ',
'θ‘γγΎγγγ§γγ',
'θ‘γγͺγγ¦',
'θ‘γγͺ',
'θ‘γγͺγγγ°'
]
}
Table
Godan Verb | Affirmative | Negative |
---|---|---|
Dict-Form | θ‘γ | θ‘γγͺγ |
Non-Past Polite | θ‘γγΎγ | θ‘γγΎγγ |
Past | θ‘γ£γ | θ‘γγͺγγ£γ |
Past Polite | θ‘γγΎγγ | θ‘γγΎγγγ§γγ |
Te-Form | θ‘γ£γ¦ | θ‘γγͺγγ¦ |
Imperative | θ‘γ | θ‘γγͺ |
Conditional | θ‘γγ° | θ‘γγͺγγγ° |
Volitional | θ‘γγ | ο½ |