PHP code example of felipecwb / soundslike
1. Go to this page and download the library: Download felipecwb/soundslike 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/ */
felipecwb / soundslike example snippets
use Felipecwb\SoundsLike\TextSearch;
$search = new TextSearch([
"São Paulo - SP",
"Osasco - SP",
"Curitiba - PR",
"Curitibanos - SC",
"Vitória - ES",
"Rio de Janeiro - RJ",
"Natal - RN"
]);
// find for the best matching text
$result = $search->findBestMatch('Sao paulo');
$result->getPhrase(); //São Paulo - SP
$result->getAgainst(); //Sao paulo
$result->getSimilarity(); //7