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

changedName1 = dek.genitiv("Velja","male") #Velje
changedName2 = dek.dativ("Petar","male") #Petru
changedName3 = dek.akuzativ("Jana","female") #Janu
changedName4 = dek.instrumental("Uroš","male") #Urošem
changedName5 = dek.instrumental("Vuk","male") #Vukom
changedName6 = dek.lokativ("Lana","female") #Lani

print("Dobili ste zahtev za prijateljstvo od",changedName1) #Dobili ste zahtev za prijateljstvo od Velje - Translation: 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', '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:

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

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

Uploaded Source

Built Distribution

deklinacija-0.0.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for deklinacija-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6db14b3d462a2df3b815a8d5e4db872aedfb7abe99851883983cc5a964261e7a
MD5 5e3b1e346243290e29b87abf2a19b7e8
BLAKE2b-256 04c6cae5771a09086fc9d432b1538f47c61956b337dc255c63539dee234e25c5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for deklinacija-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6f55ef22a16c03d2a6abc73c778f5e5a53d0d83e42860aa6797b2211131ce391
MD5 764e60bed6e3ff601b5f307293acc28b
BLAKE2b-256 182bab7e61dee82e7bc402cbd27b70ec1bcdcd332646c1ae93aa26ba71f73b0e

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