/klitikizer

Eliminating the abuse of the nominative case in Greek, one greeting at a time.

Primary LanguagePHPApache License 2.0Apache-2.0

Klitikizer

Build Status Maintainability

Klitikizer is a very simple class for PHP 7.1+ that returns the vocative case for Greek names, both first and surnames. Its aim is to eliminate the unsightly phenomenon you may have experienced when interacting with Greek e-shops, startups and other organisations that make use of PHP and just stick to the nominative case when addressing their partners, customers, users etc.

Requirements

You need Aspell with the Greek dictionary already installed in your system. Consult the Aspell documentation for more information about how to do this, depending on your Operating System. The included Dockerfile can help identify dependencies, on linux hosts.

Klitikizer requires PHP 7.1+. You also need the intl and pspell extensions (this is because the class makes use of the Normalizer to quickly replace accented characters with the non-accented/decomposed versions thereof and Pspell provides an interface to Aspell) Other than that, you should be able to make use of it as is.

Usage

See examples. In short:

$klit = new Klitikizer();
$res = $klit->getKlitikiForName('Κώστας', true);

The first parameter of getKlitikiForName is the (preferrably Greek) name you wish to convert and the second is a boolean specifying whether it's a first or last name. The function is safe for use with non-Greek names, including Unicode strings of course.