PHP code example of dd / php-library-ddtextcompare
1. Go to this page and download the library: Download dd/php-library-ddtextcompare 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/ */
dd / php-library-ddtextcompare example snippets
$compare = new DDTextCompare();
$similarity = $compare->compare("Text without any typos", "Text wihtout ayn typoes");
// $similarity = 0.99076390557741
$compare = new DDTextCompare();
$comparator = new Comparator\Cosine();
//Change the char total criterion weight
$comparator->setCharTotalWeight(0.8)
$similarity = $compare->compare("Text without any typos", "Txet wihtout ayn typoes", $comparator);
// $similarity = 0.99310343750374
$compare = new DDTextCompare();
$comparator = new Comparator\YourCustomComparator();
$similarity = $compare->compare("Text without any typos", "Txet wihtout ayn typoes", $comparator);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.