PHP Classes
elePHPant
Icontem

Phonetic Algorithms: Search text matching the sound of words

Recommend this page to a friend!
  Info   View files Documentation   View files View files (39)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-04-08 (1 month ago) RSS 2.0 feedNot enough user ratingsTotal: 120 This week: 7All time: 8,551 This week: 121Up
Version License PHP version Categories
phonetic-algorithms 2.0.0MIT/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
Nominee
Vote
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
  Performance   Level  
Name: Lars Moelleken <contact>
Classes: 17 packages by
Country: Germany Germany
Age: 29
All time rank: 1659104 in Germany Germany
Week rank: 8 Up1 in Germany Germany Up
Innovation award
Innovation award
Nominee: 7x

Details

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  
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  /  src  
File Role Description
Files folder imagevoku (1 directory)

  Files folder image Files  /  src  /  voku  
File Role Description
Files folder imagehelper (7 files, 1 directory)

  Files folder image Files  /  src  /  voku  /  helper  
File Role Description
Files folder imagestopwords (14 files)
  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  /  src  /  voku  /  helper  /  stopwords  
File Role Description
  Accessible without login Plain text file da.php Aux. Auxiliary script
  Accessible without login Plain text file de.php Aux. Auxiliary script
  Accessible without login Plain text file en.php Aux. Auxiliary script
  Accessible without login Plain text file es.php Aux. Auxiliary script
  Accessible without login Plain text file fi.php Aux. Auxiliary script
  Accessible without login Plain text file fr.php Aux. Auxiliary script
  Accessible without login Plain text file hu.php Aux. Auxiliary script
  Accessible without login Plain text file it.php Aux. Auxiliary script
  Accessible without login Plain text file nl.php Aux. Auxiliary script
  Accessible without login Plain text file no.php Aux. Auxiliary script
  Accessible without login Plain text file pt.php Aux. Auxiliary script
  Accessible without login Plain text file ru.php Aux. Auxiliary script
  Accessible without login Plain text file sv.php Aux. Auxiliary script
  Accessible without login Plain text file tr.php Aux. Auxiliary script

  Files folder image Files  /  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

Downloadphonetic-algorithms-2017-04-08.zip 41KB
Downloadphonetic-algorithms-2017-04-08.tar.gz 32KB
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:120
This week:7
All time:8,551
This week:121Up