This library allows you to effortlessly convert Serbian personal names to their correct vocative form.
- Peer-reviewed - The library has been tested with almost all Serbian names, and reviewed by a team of linguists.
- 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.
- Lightweight - The library is small and efficient, ensuring that it won't slow down your application.
You can install the library via Composer:
composer require oblak/vocative
Below is a simple example of how to use the library:
<?php
use Oblak\Vocative\Vocative;
$firstName = 'Avram';
$vocative = new Vocative();
echo $vocative->make($firstName); // Outputs: Avrame
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.
Tip
We provide a NullDictionary
class that does not use any exceptions. This is useful for testing purposes.
<?php
use Oblak\Vocative\Vocative;
use Oblak\Vocative\NullDictionary;
$firstName = 'Aleksandar';
$vocative = new Vocative();
echo $vocative->make($firstName); // Outputs: Aleksandre
echo $vocative->withDictionary(new NullDictionary())->make($firstName); // Outputs: Aleksandare
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:
- Svetlana Slijepčević Bjelivuk, PhD - For providing invaluable insights into intricacies of declination and conjugation of Serbian nouns and names and reviewing the data set.
- Nemanja Avramović - For his initial implementation of the
Vokativ
Library - Milana Bašić - For taking the time to gather and provide a list of Serbian names, both male and female.