PHP Classes


Recommend this page to a friend!
  Classes of Insolita   Russian PHP Metaphone   Download  
Role: Documentation
Content type: text/markdown
Description: Read me
Class: Russian PHP Metaphone
Generate a phonetic representation of Russian word
Author: By
Last change:
Date: 3 years ago
Size: 1,118 bytes


Class file image Download

Russian metaphone phonetic algorithm implementation for PHP

metaphone port of ruby's

see (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