frantzmiccoli / phphoneticindexing
Phonetic indexing for PHP, uses the standard library for English, Cologne phonetics for German and a custom algorithm for French
1.0.2-stable
2020-08-30 21:07 UTC
Requires (Dev)
- phpunit/phpunit: ^7.5
This package is not auto-updated.
Last update: 2024-11-19 16:08:15 UTC
README
Scope
We try to provide different languages phonetic indexing methods.
- English: uses the PHP Standard Library
soundex()
- German: uses a custom implementation of the Cologne phonetic indexing algorithm. https://en.wikipedia.org/wiki/Cologne_phonetics
- French: uses a custom algorithm (see below)
Installation
composer require frantzmiccoli/phphoneticindexing
Usage
use PhPhoneticIndexing\GetPhoneticIndex;
$getPhoneticIndex = new GetPhoneticIndex();
var_dump($getPhoneticIndex->getPhoneticIndex('carabine', 'fr')); // karabyn
Please note that if you wish to support new languages, those can be added using
$getPhoneticIndex->addLanguage()
.
French implementation
- Remove numbers and work in lower case.
- Proceed with substitution in the given order.
- Remove duplicates
- Remove
-
- If wished remove
aeiouy123
Side note
Part of this was developed during a live programming session. Unfortunately the quality is awful, but the links are here:
- Live Programming: Phonetic indexing (1/4) - project motivation and existing solutions overview https://youtu.be/l8BGkOEwCcw
- Live Programming: Phonetic indexing (2/4) - existing PHP code to support German https://youtu.be/0f-9BMp0Md4
- Live Programming: Phonetic indexing (3/4) - adapting to French language, theory and tests https://youtu.be/nFFQpKIvXeY
- Live Programming: Phonetic indexing (4/4) - French language implementation https://youtu.be/Jz365DtN9f0