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. The grammatical rules utlized in this library also apply to Croatian and Bosnian.

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. There is also the third latin parameter, which indicates whether the provided name parameter is written in the Cyrillic or Latin script. Currently, only the Latin script is supported.

The functions in this example return a string.

import deklinacija as dek

genitiv = dek.genitiv("Velja","male") #Velje
dativ = dek.dativ("Petar","male") #Petru
akuzativ = dek.akuzativ("Jana","female") #Janu
vokativ = dek.vokativ("Predrag","male") #Predraže
instrumental = dek.instrumental("Uroš","male") #Urošem
instrumental2 = dek.instrumental("Vuk","male") #Vukom
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.

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:

  • Support for both Latin and Cyrillic scripts
  • Declension of last names

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.3.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

deklinacija-1.0.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deklinacija-1.0.3.tar.gz
  • Upload date:
  • Size: 7.2 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.3.tar.gz
Algorithm Hash digest
SHA256 2e91fa2f04386899679886bd5b97564bba98e882e7f7b2fa9d190d49907df07e
MD5 e743926ffacba4a0d12b3a82b4f9d818
BLAKE2b-256 1052d03fda89afbf534530e8809ff991215bfb884f85901788a98225d049fefb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deklinacija-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b261a40a6c226edc09a4a3c5d75633feaccae0817a8e5ee1faa5c78cf9d53e98
MD5 e1700b306084e40639224b7d9214193f
BLAKE2b-256 34ee28b05b2817e22a38cf4e9b688443d9d09c043beaaa958711659eb2bc504d

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