php-extended/php-score-object
最新稳定版本:8.0.10
Composer 安装命令:
composer require php-extended/php-score-object
包简介
A library that implements the php-score-interface package
README 文档
README
A library that implements the php-score-interface package
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.pharfrom their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-score-object ^8
Basic Usage
You may use this library the following way :
use PhpExtended\Score\StringLevenshteinScore;
use PhpExtended\Score\ScoreCollection;
use PhpExtended\Score\PresumptionGuiltPolicy;
// First, let's image you have three strings and a reference string, and you
// want to know which is the global distance of the three strings from the
// reference
$reference = '<put your reference string here>';
$test1 = '<put your first test string here>';
$test2 = '<put your second test string here>';
$test3 = '<put your third test string here>';
$score1 = new StringLevenshteinScore($reference, $test1);
$score2 = new StringLevenshteinScore($reference, $test2);
$score3 = new StringLevenshteinScore($reference, $test3);
// Next, concatenate the results
$collection = new ScoreCollection();
$collection->add($score1);
$collection->add($score2);
$collection->add($score3);
// Finally, get the mean value
$result = $collection->resolve(new PresumptionGuiltPolicy());
// To get the result as a number between 0 and 1, use the getNormalizedValue()
// of the IScore object $result.
License
MIT (See license file).
统计信息
- 总下载量: 15.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 8
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-09