Skip to content

Commit 16a18ff

Browse files
committed
feat: Finalized name inflection
1 parent f990f9a commit 16a18ff

File tree

8 files changed

+285
-110
lines changed

8 files changed

+285
-110
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vendor
22
test.php
3+
/*.txt

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
[![Packagist Version](https://img.shields.io/packagist/v/oblak/vocative?label=Release&style=flat-square&logo=packagist&logoColor=white)](https://packagist.org/packages/oblak/vocative)
7+
![Packagist PHP Version](https://img.shields.io/packagist/dependency-v/oblak/vocative/php?label=PHP&logo=php&logoColor=white&logoSize=auto&style=flat-square)
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

Comments
 (0)