Skip to main content

A Japanese inflections tool

Project description

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 行こう

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 hashes)

Uploaded Source

Built Distribution

PyKatsuyou-1.1.1-py3-none-any.whl (11.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page