itk-dev/sentence-similarity-metrics
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
itk-dev/sentence-similarity-metrics 适用场景与选型建议
itk-dev/sentence-similarity-metrics 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 358 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 02 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 itk-dev/sentence-similarity-metrics 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 itk-dev/sentence-similarity-metrics 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 358
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-04