|
| 1 | +<div align="center"> |
| 2 | + |
| 3 | +<h1 align="center" style="border-bottom: none; margin-bottom: 0px">Vocative 🗣️</h1> |
| 4 | +<h3 align="center" style="margin-top: 0px">Vocative inflector for Serbian names</h3> |
| 5 | + |
| 6 | +[](https://packagist.org/packages/oblak/vocative) |
| 7 | + |
| 8 | + |
| 9 | +</div> |
| 10 | + |
| 11 | +This library allows you to effortlessly convert Serbian personal names to their correct vocative form. |
| 12 | + |
| 13 | +## Key Features |
| 14 | + |
| 15 | +1. **Peer-reviewed** - The library has been tested with almost all Serbian names, and reviewed by a team of linguists. |
| 16 | +2. Easy to use - The library is designed to be simple and intuitive, making it easy for developers of all skill levels to integrate into their projects. |
| 17 | +3. Lightweight - The library is small and efficient, ensuring that it won't slow down your application. |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +You can install the library via Composer: |
| 22 | + |
| 23 | +```bash |
| 24 | +composer require oblak/vocative |
| 25 | +``` |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +Below is a simple example of how to use the library: |
| 30 | + |
| 31 | + |
| 32 | +### Basic Usage |
| 33 | + |
| 34 | +```php |
| 35 | +<?php |
| 36 | + |
| 37 | +use Oblak\Vocative\Vocative; |
| 38 | + |
| 39 | +$firstName = 'Avram'; |
| 40 | +$vocative = new Vocative(); |
| 41 | + |
| 42 | +echo $vocative->make($firstName); // Outputs: Avrame |
| 43 | + |
| 44 | +``` |
| 45 | + |
| 46 | +### With custom dictionary |
| 47 | + |
| 48 | +`Vocative` class depends on an **exception dictionary** to handle special cases. By default it uses the built-in `BaseDictionary` class, but you can use your own by implementing the `Dictionary` interface. |
| 49 | + |
| 50 | +> [!TIP] |
| 51 | +> We provide a `NullDictionary` class that does not use any exceptions. This is useful for testing purposes. |
| 52 | +
|
| 53 | +```php |
| 54 | +<?php |
| 55 | + |
| 56 | +use Oblak\Vocative\Vocative; |
| 57 | +use Oblak\Vocative\NullDictionary; |
| 58 | + |
| 59 | +$firstName = 'Aleksandar'; |
| 60 | +$vocative = new Vocative(); |
| 61 | + |
| 62 | +echo $vocative->make($firstName); // Outputs: Aleksandre |
| 63 | +echo $vocative->withDictionary(new NullDictionary())->make($firstName); // Outputs: Aleksandare |
| 64 | + |
| 65 | +``` |
| 66 | + |
| 67 | +## Special thanks |
| 68 | + |
| 69 | +As someone without deep expertise in Serbian linguistics, I am deeply grateful to the following individuals—without their guidance and support, this project could never have been completed: |
| 70 | + |
| 71 | +* **[Svetlana Slijepčević Bjelivuk, PhD](https://jezikofil.rs)** - For providing invaluable insights into intricacies of declination and conjugation of Serbian nouns and names and reviewing the data set. |
| 72 | +* **[Nemanja Avramović](https://github.com/avramovic)** - For his initial implementation of the `Vokativ` Library |
| 73 | +* **Milana Bašić** - For taking the time to gather and provide a list of Serbian names, both male and female. |
0 commit comments