Skip to content

GordonLesti/levenshtein

Repository files navigation

levenshtein

Latest Version on Packagist Software License Build Status Coverage Status Total Downloads

Plain PHP implementation of the Levenshtein distance.

  • No 255 characters limit
  • Works with UTF-8
  • Accepts float as custom costs

Install

Via Composer

$ composer require gordonlesti/levenshtein

Usage

use GordonLesti\Levenshtein\Levenshtein;

With default default costs.

$levDist = Levenshtein::levenshtein("AC", "ABAA");

With insert cost 7.7, replace cost 9.4 and delete cost 2.5.

$levDist = Levenshtein::levenshtein("ACCB", "BC", 7.7, 9.4, 2.5);

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email info@gordonlesti.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.