PHP code example of dautkom / bmdm

1. Go to this page and download the library: Download dautkom/bmdm library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dautkom / bmdm example snippets




// You want to run ./composer install before
g with a Beider-Morse algorithm and retrieve BM phonetic keys
$p = $bmdm->set('Hello world')->soundex()

// Try to guess string's language
$l = $bmdm->set('Grzegorz')->guess()

// Retrieve all supported languages
$g = $bmdm->getLanguages()

// Process string with a Beider-Morse algorithm and retrieve phonetic keys
$b = $bmdm->set('ברצלונה')->bm->soundex()

// Try to guess string's language and retrieve only language names
$l = $bmdm->set('Grzegorz')->bm->getLanguageNames()

// Retrieve Daitch-Mokotoff soundex values
// Only latin symbols are supported
$d = $bmdm->set('Grzegorz')->dm->soundex()




ing 'ash' upon init will load Ashkenazi phonetic rules
// Use 'sep' instead of 'ash' to init Sephardic rules
$bmdm = new \dautkom\bmdm\BMDM('ash');




= new \dautkom\bmdm\BMDM();

$p = $bmdm->set('This is Спарта!')->soundex()




= new \dautkom\bmdm\BMDM();

// Words in different languages with the same pronunciation
// in most cases give intersections in results.

print_r($bmdm->set('Zelinska')->soundex());
print_r($bmdm->set('Зелинска')->soundex());

// ## Latin string
// Array
// (
//     [input] => zelinska
//     [numeric] => Array
//         (
//             [0] => Array
//                 (
//                     [0] => 486450
//                 )
// 
//         )
// 
//     [phonetic] => Array
//         (
//             [0] => Array
//                 (
//                     [0] => zYlnzki
//                     [1] => zilnzki
//                 )
// 
//         )
// 
// )
//
// ## Cyrillic string 
// Array
// (
//     [input] => зелинска
//     [numeric] => Array
//         (
//             [0] => Array
//                 (
//                     [0] => 486450
//                 )
// 
//         )
// 
//     [phonetic] => Array
//         (
//             [0] => Array
//                 (
//                     [0] => zYlnzka
//                     [1] => zYlnzko
//                     [2] => zilnzka
//                     [3] => zilnzko
//                 )
// 
//         )
// 
// )