PyKatsuyou

A Japanese inflections tool


Keywords
japanese, inflections, conjugation, japanese-language, linguistics, python3
License
MIT
Install
pip install PyKatsuyou==1.1.1

Documentation

PyKatsuyou

A Japanese verb/adjective inflections tool for python.

PyKatsuyou uses these great packages:

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