PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Insolita   Russian PHP Metaphone   README.md   Download  
File: README.md
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: 4 years ago
Size: 1,118 bytes
 

Contents

Class file image Download

Russian metaphone phonetic algorithm implementation for PHP

metaphone port of ruby's https://github.com/pavlo/russian_metaphone

https://en.wikipedia.org/wiki/Metaphone

see http://forum.aeroion.ru/topic461.html (Russian algorithm description)

Installation

composer require insolita/metaphone

Usage

<?php

$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