v-bartusevicius/levenshtein-array-sort
Composer 安装命令:
composer require v-bartusevicius/levenshtein-array-sort
包简介
Sorts haystack with strings by Levenshtein distance to needle
关键字:
README 文档
README
Sorts given array of strings by Levenshtein distance.
Simply use:
$needle = 'text'; $haystack = array('texas', 'test', 'random'); $sorter = new ArraySort(); $result = $sorter->sort($needle, $haystack); print_r($result);
The result will be represented as ordered array with keys as Levenshtein distance to needle:
Array
(
[1] => test
[2] => texas
[6] => random
)
In case there are same distances to needle, the nested array will be created:
$needle = 'text'; $haystack = array('texas', 'test', 'texts', 'random'); $result = $sorter->sort($needle, $haystack); print_r($result);
Array
(
[1] => Array
(
[0] => test
[1] => texts
)
[2] => texas
[6] => random
)
#Installation:
composer require v-bartusevicius/levenshtein-array-sort
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2015-03-07