Skip to main content

shevchenko-python

Python library for declension of Ukrainian anthroponyms. Port of shevchenko.js.

Installation

pip install shevchenko

Usage

from shevchenko import in_nominative, in_genitive, in_dative, in_accusative, in_ablative, in_locative, in_vocative, GrammaticalGender

input_data = {
    'gender': GrammaticalGender.MASCULINE,
    'givenName': 'Тарас',
    'patronymicName': 'Григорович',
    'familyName': 'Шевченко'
}

# Nominative: Тарас Григорович Шевченко
print(in_nominative(input_data))

# Genitive: Тараса Григоровича Шевченка
print(in_genitive(input_data))

# Dative: Тарасу Григоровичу Шевченку
print(in_dative(input_data))

# Accusative: Тараса Григоровича Шевченка
print(in_accusative(input_data))

# Ablative: Тарасом Григоровичем Шевченком
print(in_ablative(input_data))

# Locative: Тарасові Григоровичу Шевченку
print(in_locative(input_data))

# Vocative: Тарасе Григоровичу Шевченку
print(in_vocative(input_data))

Using Extensions

You can extend the library to support declension of additional fields. For example, to declin military ranks and appointments using the shevchenko-ext-military extension:

from shevchenko import inflect, GrammaticalCase
from shevchenko.extension import register_extension
from shevchenko_ext_military import military_extension

# Register the military extension
register_extension(military_extension)

input_data = {
    'gender': 'masculine',
    'givenName': 'Тарас',
    'familyName': 'Шевченко',
    'militaryRank': 'Генерал-майор',
    'militaryAppointment': 'Командир'
}

# Inflect including the custom fields
result = inflect(input_data, GrammaticalCase.DATIVE)

print(f"{result['militaryRank']} {result['militaryAppointment']} {result['givenName']} {result['familyName']}")
# Output: Генерал-майору Командиру Тарасу Шевченку

Features

  • Declension of given names, patronymic names, and family names.
  • Auto-detection of grammatical gender (if not provided, though recommended to provide).
  • Support for all grammatical cases.
  • Uses regex library for advanced pattern matching compatibility with JS version.

License

MIT

Metadata

Release files for shevchenko 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shevchenko 1.0.0
File Size Uploaded
shevchenko-1.0.0.tar.gz 21.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shevchenko 1.0.0
File Interpreter ABI Platform
shevchenko-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 50.4 kB

Release files / shevchenko-1.0.0.tar.gz

Download URL shevchenko-1.0.0.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e509078ba24985ca021cf8bf8abce7d49c5e8ded4ab3cc6709af6a3da30edbea
BLAKE2b-256 checksum
How to use checksums
645da02267a4b828731bd6453efca3b6874e541d4789fcbdb3bb6cac13e50144
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / shevchenko-1.0.0-py3-none-any.whl

Download URL shevchenko-1.0.0-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a8060fb278ef43114fca385eaad3e28f79eb78fce8af3ef7f043277e5cbb2a6
BLAKE2b-256 checksum
How to use checksums
68ea5551ed33a541a243ddf465cc2268cea69c15a897acc8f1b7fdc96f54518a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page