PHP Classes

Phonetic Algorithms: Search text matching the sound of words

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 58%Total: 193 All time: 8,552 This week: 206Up
Version License PHP version Categories
phonetic-algorithms 2.0.9MIT/X Consortium ...5PHP 5, Text processing, Audio
Description 

Author

This package can search text matching the sound of words.

It can match text of single words or sentences according to the similarity of the sound of the words in different languages.

Currently it provides classes specialized in matching word sounding in English, French and German.

Innovation Award
PHP Programming Innovation award nominee
April 2017
Number 7
Sometimes it is necessary to match words by the sound a person would make to pronounce them because users may be misspelling the words due to typing mistakes eventually caused by confusion between similar words.

There are algorithms like soundex and metaphone that can match words by the way they sound. However, sometimes these algorithms only work well for matching English words.

This package provides a broader solution that can match better words by the way they sound in a way that works with other languages like French and German.

Manuel Lemos
Picture of Lars Moelleken
  Performance   Level  
Name: Lars Moelleken <contact>
Classes: 25 packages by
Country: Germany Germany
Age: 36
All time rank: 62140 in Germany Germany
Week rank: 22 Up2 in Germany Germany Up
Innovation award
Innovation award
Nominee: 11x

Winner: 1x

Documentation

Build Status Coverage Status Scrutinizer Code Quality Codacy Badge SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License

Phonetic-Algorithms

Description

  • "PhoneticGerman"-Class:

A phonetic algorithms for the german language via "Kölner Phonetik": en.wikipedia.org/wiki/Cologne_phonetics

  • "PhoneticEnglish"-Class:

A phonetic algorithms for the english language via "metaphone": en.wikipedia.org/wiki/Metaphone

  • "PhoneticFrench"-Class:

A phonetic algorithms for the french language via "SOUNDEX FR": www.roudoudou.com/phonetic.php

Installation

  1. Install and use composer in your project.
  2. Require this package via composer:
composer require voku/phonetic-algorithms

Usage

You the "phonetic_word"-method if you need a fuzzy-search for single words e.g. last-names or product-names.

use voku\helper\Phonetic;

$words = array(
  'Moelleken',
  'Mölleken',
  'Möleken',
  'Moeleken',
  'Moellecken',
  'Möllecken',
  'Mölecken',
);
$phonetic = new Phonetic('de');
foreach ($words as $word) {
  $phonetic->phonetic_word($string); // '6546'
}

You can use the "phonetic_sentence"-method to process sentences.

use voku\helper\Phonetic;

$string = 'Ein Satz mit vielen Wortern';
$phonetic = new Phonetic('de');
$phonetic->phonetic_sentence($string, (bool) false, (false|int) false); 

// [
//   'Ein' => '06', 
//   'Satz' => '8', 
//   'mit' => '62', 
//   'vielen' => '356', 
//   'Wortern' => '37276'
// ]

You can use the "phonetic_matches"-method to search for words in an array of words.

use voku\helper\Phonetic;

$phonetic = new Phonetic('de');

$tests = array(
    'Moelleken',  // '6546',
    'Mölleken',   // '6546',
    'Möleken',    // '6546',
    'Moeleken',   // '6546',
    'oder',       // '027',
    'was',        // '38',
    'Moellecken', // '6546',
    'Möllecken',  // '6546',
    'Mölecken',   // '6546',
);

$phonetic->phonetic_matches('Moelleken', $tests);
    
// [
//   'Moelleken'  => 'Moelleken',
//   'Mölleken'   => 'Moelleken',
//   'Möleken'    => 'Moelleken',
//   'Moeleken'   => 'Moelleken',
//   'Moellecken' => 'Moelleken',
//   'Möllecken'  => 'Moelleken',
//   'Mölecken'   => 'Moelleken',
// ]

History

See CHANGELOG for the full history of changes.


  Files folder image Files (25)  
File Role Description
Files folder imagesrc (1 directory)
Files folder imagetests (5 files)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file circle.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file ISSUE_TEMPLATE.md Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file PULL_REQUEST_TEMPLATE.md Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (25)  /  src  
File Role Description
Files folder imagevoku (1 directory)

  Files folder image Files (25)  /  src  /  voku  
File Role Description
Files folder imagehelper (7 files)

  Files folder image Files (25)  /  src  /  voku  /  helper  
File Role Description
  Plain text file Phonetic.php Class Class source
  Plain text file PhoneticEnglish.php Class Class source
  Plain text file PhoneticExceptionClassNotExists.php Class Class source
  Plain text file PhoneticExceptionLanguageNotExists.php Class Class source
  Plain text file PhoneticFrench.php Class Class source
  Plain text file PhoneticGerman.php Class Class source
  Plain text file PhoneticInterface.php Class Class source

  Files folder image Files (25)  /  tests  
File Role Description
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file EnglishPhoneticAlgorithmsTest.php Class Class source
  Plain text file FrenchPhoneticAlgorithmsTest.php Class Class source
  Plain text file GermanPhoneticAlgorithmsTest.php Class Class source
  Plain text file PhoneticAlgorithmsTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
Downloadphonetic-algorithms-2018-10-19.zip 26KB
Downloadphonetic-algorithms-2018-10-19.tar.gz 20KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
PHP Stop Words List Download .zip .tar.gz for the stop-words ;) Required
 Version Control Unique User Downloads Download Rankings  
 100%
Total:193
This week:0
All time:8,552
This week:206Up
 User Ratings  
 
 All time
Utility:83%StarStarStarStarStar
Consistency:83%StarStarStarStarStar
Documentation:83%StarStarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:58%StarStarStar
Rank:1525