|Ratings|| ||Unique User Downloads|| ||Download Rankings|
|Not yet rated by the users||Total: 30 ||All time: 10,349 This week: 243|
This package can generate a phonetic representation of Russian word.
It can take a string with Russian words and returns another string that is the result of applying the Metaphone algorithm considering the way the words are spelled in Russian.
The package an apply several types of filters to the words that consider several aspects like consonants, last name endings and double characters.
|Metaphone is popular algorithm that is used to convert words in a given language to the phonetic representation of the words.
This allows to compare two words or two sentences to detect how similar they may be in terms of pronunciation.
This way it is possible to detect if the user has written a given word or sentence with spelling mistakes.
The pronunciation rules are different from language to language. The most common implementations of the algorithm are meant to be used with sentences in the English language.
This package provides an implementation of the Metaphone algorithm that works well in Russian.
Russian metaphone phonetic algorithm implementation for PHP
port of ruby's https://github.com/pavlo/russian_metaphone
see http://forum.aeroion.ru/topic461.html (Russian algorithm description)
composer require insolita/metaphone
$word = '????';
$phonetic = (new Metaphone())->processWord($word); //????
Default set of filters include filter for lastname endings, if you want exclude only these filter, you can use helper
$withLastnames = (new Metaphone())->processWord('????????????'); //??????#
$withoutLastnames = (new Metaphone())->skipLastnames()->processWord('????????????'); //????????????
Provide custom filters. Each filter must implement insolita\metaphone\Filter
$metaphone = new Metaphone([Normalize::class, new CustomFilter($params), new HandleConsonants(true), ...])
$phonetic = $metaphone->processWord($word);
See tests folder for better understanding filters
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.