Skip to main content

A Python library for declension of personal names in Serbian

Project description

deklinacija

A Python library for declension of personal names in Serbian, with support for both Cyrillic and Latin scripts.

Installation

The source code is currently hosted on GitHub: https://github.com/urelja/deklinacija

The latest binary versions are hosted on the Python Package Index (PyPI): https://pypi.org/project/deklinacija/

pip install deklinacija

Usage

Simply import the package. It is recommended to set the alias to dek.

import deklinacija as dek

As of right now, only first names are supported. To decline names, all you have to do is to call the appropriate function for the grammatical case you want to use, and specify the name and the gender parameter. The name parameter must be a string, can have either Latin or Cyrillic characters (automatically detected), and can contain uppercase or lowercase letters (the script respects the capitalisation of the name and will capitalise the added suffixes according to the last character's capitalisation, see vokativ2 below).

The functions in this example return a string.

import deklinacija as dek

genitiv = dek.genitiv("Velja","male") #Velje
dativ = dek.dativ("Петар","male") #Петру
akuzativ = dek.akuzativ("Jana","female") #Janu
vokativ = dek.vokativ("Predrag","male") #Predraže
vokativ2 = dek.vokativ("PREDRAG","male") #PREDRAŽE
instrumental = dek.instrumental("Uroš","male") #Urošem
instrumental2 = dek.instrumental("Вук","male") #Вуком
lokativ = dek.lokativ("Lana","female") #Lani

print(f"Zdravo, {vokativ}! Dobio si zahtev za prijateljstvo od {genitiv}.") 
#Zdravo Predraže! Dobio si zahtev za prijateljstvo od Velje.
#Translation: Hello Predrag! You have received a friend request from Velja.

You can also immediatelly decline a name through all grammatical cases by calling the declineAll() function.

The declineAll() function returns a dictionary, where keys are the grammatical cases.

import deklinacija as dek

Nikola = dek.declineAll("Nikola","male") 
#{'nominativ': 'Nikola', 'genitiv': 'Nikole', 'dativ': 'Nikoli', 'akuzativ': 'Nikolu', 
#'vokativ':'Nikola', 'instrumental': 'Nikolom', 'lokativ': 'Nikoli'}

print("Dali ste poklon",Nikola['dativ']) 
#Dali ste poklon Nikoli
#Translation: You have given a gift to Nikola

Todo

The following features are on the roadmap:

  • Declension of last names
  • Possessive forms

Attribution

Vokativi by Startit is licensed under CC BY 4.0 / Modifications: converted to Cyrillic and filtered out names longer than 4 characters

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

deklinacija-1.0.4.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

deklinacija-1.0.4-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file deklinacija-1.0.4.tar.gz.

File metadata

  • Download URL: deklinacija-1.0.4.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for deklinacija-1.0.4.tar.gz
Algorithm Hash digest
SHA256 3225cfdaa210e674e1fb5040fe450feb44dd653930bdd6f2ad90bdd13e2b431c
MD5 36bc8cf37488d8666ffb64e56041a3b2
BLAKE2b-256 324cca3e51ddc0568dae452fa993ada42e3ef616d65cd73f97dedc92869c2cf8

See more details on using hashes here.

File details

Details for the file deklinacija-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: deklinacija-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for deklinacija-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cba7c3c351060b591ae63776605d8674bc55ae1207e80824150820d71e56dd6e
MD5 ef6cf92906c74baed0230bceda5e625f
BLAKE2b-256 6dd53a7bda18db6a4acb38be3d806bbcb072f179a88b3290d42d8c8cf39ef9e5

See more details on using hashes here.

Supported by

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