deklinacija
A Python library for declension of personal names in Serbian, with support for both Cyrillic and Latin scripts, and last names.
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
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). You can also input a full name (with a first name and a last name, multiple last names are supported too, separated with a whitespace character) and the script will change the name accordingly.
The functions in this example return a string.
import deklinacija as dek
genitiv = dek.genitiv("Velja","male") #Velje
genitiv2 = dek.genitiv("Velja Petrović","male") #Velje Petrovića
dativ = dek.dativ("Jana","female") #Jani
dativ2 = dek.dativ("Jana Paunovska","female") #Jani Paunovskoj
akuzativ = dek.akuzativ("Петар","male") #Петра
akuzativ2 = dek.akuzativ("Петар Петровић","male") #Петра Петровића
vokativ = dek.vokativ("Predrag","male") #Predraže
vokativ2 = dek.vokativ("PREDRAG JANKOVIĆ","male") #PREDRAŽE JANKOVIĆU
instrumental = dek.instrumental("Uroš","male") #Urošem
instrumental2 = dek.instrumental("Uroš Konstantinović","male") #Urošem Konstantinovićem
lokativ = dek.lokativ("Lana","female") #Lani
lokativ = dek.lokativ("Lana Petrović","female") #Lani Petrović
print(f"Zdravo, {vokativ}! Dobio si zahtev za prijateljstvo od {genitiv2}.")
#Zdravo Predraže! Dobio si zahtev za prijateljstvo od Velje Petrovića.
#Translation: Hello Predrag! You have received a friend request from Velja Petrović.
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
name = dek.declineAll("Nikola","male")
#{'nominativ': 'Nikola', 'genitiv': 'Nikole', 'dativ': 'Nikoli', 'akuzativ': 'Nikolu',
#'vokativ':'Nikola', 'instrumental': 'Nikolom', 'lokativ': 'Nikoli'}
print("Dali ste poklon",name['dativ'])
#Dali ste poklon Nikoli
#Translation: You have given a gift to Nikola
Todo
The following features are on the roadmap:
- Possessive forms
Attribution
Vokativi by Startit is licensed under CC BY 4.0 / Modifications: converted to Cyrillic and filtered out names longer than 6 characters
Metadata
Release files for deklinacija 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| deklinacija-1.6.0.tar.gz | 16.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deklinacija-1.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.7 kB
Release files / deklinacija-1.6.0.tar.gz
| Download URL | deklinacija-1.6.0.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f210ac41f5ce4e65cf6d044b78b0125249a71b1ea042ef065b229105244ac546
|
|
BLAKE2b-256 checksum How to use checksums |
3405a2a97ff8e1f5dcbabca6623c9d9160394ab49f1c242ada0d51a4dc899378
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / deklinacija-1.6.0-py3-none-any.whl
| Download URL | deklinacija-1.6.0-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33ef743181124f29f9d69214f69c900b1b7dfb5c440c5e3dc54acc88bb822372
|
|
BLAKE2b-256 checksum How to use checksums |
c4aefd801a02175e261d6232b77255a2eae3dc47ed4f2fddc0e15c6a02cd8997
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|