famelo/string-score
Composer 安装命令:
composer require famelo/string-score
包简介
Extension to fetch Avatars from different sources
README 文档
README
Quicksilver style string scoring based on https://github.com/joshaven/string_score
Examples
use Famelo\StringScore\StringScore;
StringScore::score("hello world", "axl") //=> 0
StringScore::score("hello world", "ow") //=> 0.35454545454545455
// And then there is fuzziness
StringScore::score("hello world", "hello wor1") //=>0 (the "1" in place of the "l" makes a mismatch)
StringScore::score("hello world", "hello wor1",0.5) //=>0.6081818181818182 (fuzzy)
// Considers string length
StringScore::score('Hello', 'h') //=>0.52
StringScore::score('He', 'h') //=>0.6249999999999999 (better match becaus string length is closer)
// Same case matches better than wrong case
StringScore::score('Hello', 'h') //=>0.52
StringScore::score('Hello', 'H') //=>0.5800000000000001
// Acronyms are given a little more weight
StringScore::score("Hillsdale Michigan", "HiMi") > "Hillsdale Michigan", "Hills")
StringScore::score("Hillsdale Michigan", "HiMi") < "Hillsdale Michigan", "Hillsd")
统计信息
- 总下载量: 155
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-06-06