Metadata-Version: 2.1
Name: lesya
Version: 0.0.7
Summary: Python package to form Ukrainian names cases : 'Леся Українка' -- 'Лесі Українки' , 'Лесі Українці', 'Лесею Українкою' ... etc.
Author: Dmytro Ustynov
Author-email: Dmytro Ustynov <ustynov.dev@gmail.com>
License: Copyright (c) 2018 The Python Packaging Authority
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/ustynov-py-dev/lesya.git
Project-URL: Issues, https://github.com/ustynov-py-dev/lesya/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

# Lesya

Lesya is a simple Python package for declining Ukrainian personal names into Ukrainian grammatical cases (_відмінки_): NOMINATIVE, GENITIVE, DATIVE, ACCUSATIVE, INSTRUMENTAL, PREPOSITIONAL, and VOCATIVE (_називний, родовий, давальний, знахідний, орудний, місцевий, кличний_).

## Usage example

The most common usage is to convert a name into all cases:

```python
from lesya import Lesya

person = Lesya('Леся Українка')
print(person.nominative) # Леся Українка
print(person.genitive) # Лесі Українки
print(person.dative) # Лесі Українці
print(person.accusative) # Лесю Українку
print(person.instrumental) # Лесею Українкою
print(person.prepositional) # Лесі Українці
print(person.vocative) # Лесе Українко
```

You can also get a name in a specific case:

```python
from lesya import Lesya
from lesya import CaseUA

person = Lesya('Тарас Григорович Шевченко')
print(person[CaseUA.DATIVE]) # Тарасу Григоровичу Шевченку
print(person[CaseUA.PREPOSITIONAL]) # Тарасові Григоровичу Шевченкові
print(person['орудний']) # Тарасом Григоровичем Шевченком
```

## Double names support

Lesya works well with double last names:
    
```python
from lesya import Lesya

person = Lesya('Іван Семенович Нечуй-Левицький')
print(person.forms)
# Output:
{
    'називний': 'Іван Семенович Нечуй-Левицький', 
    'родовий': 'Івана Семеновича Нечуя-Левицького', 
    'давальний': 'Івану Семеновичу Нечуєві-Левицькому', 
    'знахідний': 'Івана Семеновича Нечуя-Левицького', 
    'орудний': 'Іваном Семеновичем Нечуєм-Левицьким', 
    'місцевий': 'Іванові Семеновичу Нечуєві-Левицькому', 
    'кличний': 'Іване Семеновичу Нечую-Левицький'
}
```

## `forms` attribute

You can get all cases at once using the forms attribute. It returns a dictionary where the keys are case names (in lowercase Ukrainian), and the values are the corresponding declined names.

## Foreign names support

Lesya supports foreign names. However, since it does not use an ML model to automatically detect a person's gender, it works better if you explicitly provide the gender:

```python
from lesya import Lesya
from lesya import CaseUA
from lesya import Gender

person = Lesya('Джозеф Байден', gender='male')  
print(person[CaseUA.DATIVE]) # Джозефу Байдену
print(person[CaseUA.PREPOSITIONAL]) # Джозефові Байденові

person = Lesya('Камала Гаріс', gender=Gender.FEMALE)
print(person[CaseUA.DATIVE]) # Камалі Гаріс
print(person[CaseUA.PREPOSITIONAL]) # Камалі Гаріс
```
