itk-dev/sentence-similarity-metrics
最新稳定版本:0.1.0
Composer 安装命令:
composer require itk-dev/sentence-similarity-metrics
包简介
Sentence similarity metrics
README 文档
README
A PHP library containing metrics for comparing sentences.
Install
You can install this library by utilizing PHP Composer, which is the recommended dependency management tool for PHP.
composer require itk-dev/sentence-similarity-metrics
Metrics
Word error rate (WER)
WER is a metric used for determining the performance of a speech recognition system. See Wikipedia: Word error rate and Metric: wer for more information.
WER compares a reference sentence to a prediction made by a speech recognition system.
use ItkDev\SentenceSimilarityMetrics\WordErrorRate; $wordErrorRate = new WordErrorRate(); $reference = 'I am 32 years old and I am a software developer'; $prediction = 'I am a 32 year old and I am as a developer'; $wer = $wordErrorRate->wer($reference, $prediction); // 0.36363636363636365
Character error rate (CER)
CER is WER on character level rather than word level.
use ItkDev\SentenceSimilarityMetrics\CharacterErrorRate; $characterErrorRate = new CharacterErrorRate(); $reference = 'I am 32 years old and I am a software developer'; $prediction = 'I am a 32 year old and I am as a developer'; $cer = $characterErrorRate->cer($reference, $prediction); // 0.2127659574468085
Development
Install
To install the dependencies required for the development and usage of this
library, run composer install through the supplied docker compose setup.
docker compose run --rm phpfpm composer install
Tests
We use the PHPUnit testing framework.
To run tests execute the following command:
docker compose run --rm phpfpm vendor/bin/phpunit --coverage-clover=coverage/unit.xml
Check coding standards
The following commands let you test that the code follows the coding standards we decided to adhere to in this project.
docker compose run --rm phpfpm composer coding-standards-check
Check Markdown file
docker run --rm --volume "$PWD:/md" itkdev/markdownlint **/*.md --fix docker run --rm --volume "$PWD:/md" itkdev/markdownlint **/*.md
Apply coding standards
You can automatically fix some coding styles issues by running:
docker compose run --rm phpfpm composer coding-standards-apply
统计信息
- 总下载量: 319
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-04