olevv / similarity-strings
Appraiser similarity strings
v0.1.0
2019-04-07 12:30 UTC
Requires
- php: ^7.0
Requires (Dev)
This package is auto-updated.
Last update: 2025-03-08 02:20:38 UTC
README
Library to compare strings similarity written in PHP
Setup
Should be installed php 7
Then install similarity-strings library itself:
composer require olevv/similarity-strings
Usage
<?php declare(strict_types=1); use Olevv\SimilarityStrings\Algorithm\Levenstein; require_once __DIR__ . '/vendor/autoload.php'; $strOne = 'Hi, I live in Saint Petersburg, Russia'; $strTwo = "Hi, I'm from Saint-Petersburg, live in Russia"; $levenstein = new Levenstein; $similarity = $levenstein->calculate($strOne, $strTwo); echo 'Levenstein: ' . $similarity . "\n";