https://github.com/gordonlesti/levenshtein
Plain PHP implementation of the Levenshtein distance
https://github.com/gordonlesti/levenshtein
levenshtein-distance php
Last synced: about 1 year ago
JSON representation
Plain PHP implementation of the Levenshtein distance
- Host: GitHub
- URL: https://github.com/gordonlesti/levenshtein
- Owner: GordonLesti
- License: mit
- Created: 2017-01-19T11:35:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-08T08:55:54.000Z (over 9 years ago)
- Last Synced: 2025-04-13T19:56:21.140Z (about 1 year ago)
- Topics: levenshtein-distance, php
- Language: PHP
- Homepage: https://gordonlesti.com/levenshtein-distance-in-php-without-255-characters-limit/
- Size: 13.7 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# levenshtein
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]
[![Coverage Status][ico-coveralls]][link-coveralls]
[![Total Downloads][ico-downloads]][link-downloads]
Plain PHP implementation of the Levenshtein distance.
* No 255 characters limit
* Works with UTF-8
* Accepts float as custom costs
## Install
Via Composer
``` bash
$ composer require gordonlesti/levenshtein
```
## Usage
``` php
use GordonLesti\Levenshtein\Levenshtein;
```
With default default costs.
``` php
$levDist = Levenshtein::levenshtein("AC", "ABAA");
```
With insert cost `7.7`, replace cost `9.4` and delete cost `2.5`.
``` php
$levDist = Levenshtein::levenshtein("ACCB", "BC", 7.7, 9.4, 2.5);
```
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.
## Security
If you discover any security related issues, please email info@gordonlesti.com instead of using the issue tracker.
## Credits
- [Gordon Lesti][link-author]
- [All Contributors][link-contributors]
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
[ico-version]: https://img.shields.io/packagist/v/gordonlesti/levenshtein.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/GordonLesti/levenshtein/master.svg?style=flat-square
[ico-coveralls]: https://img.shields.io/coveralls/GordonLesti/levenshtein/master.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/gordonlesti/levenshtein.svg?style=flat-square
[link-packagist]: https://packagist.org/packages/gordonlesti/levenshtein
[link-travis]: https://travis-ci.org/GordonLesti/levenshtein
[link-coveralls]: https://coveralls.io/r/GordonLesti/levenshtein?branch=master
[link-downloads]: https://packagist.org/packages/gordonlesti/levenshtein
[link-author]: https://gordonlesti.com
[link-contributors]: ../../contributors