text-utils/n-gram
Composer 安装命令:
composer require text-utils/n-gram
包简介
PHP Helpers to get n-grams
README 文档
README
Generate n-grams for your string.
N-grams?
Why does this project exist? Come on, don't delete this part. Fill it. Yes it's hard, but it's perhaps the most important part of the README.
As to why this project exist, it's to serve as a template for future open source PHP projects. Of course, feel free to fork it and make your own recipe.
Installation
composer install text-utils/n-gram
Usage
You can start using the n-gram generator by instantiating a new NGram class:
$n = 1; $generator = new TextUtils\NGram($n, 'Foo'); $nGram = $generator->get(); // array ('F', 'o', 'o')
We also provide a static wrapper (the for method) and two helper functions (bigram and trigram) for quick usage
$nGram = TextUtils\NGram::for('string', 3); // array ('str', 'tri', 'rin', 'ing') ... $biGram = bigram('foo'); // array ('fo', 'oo') $triGram = trigram('foobar'); // array ('foo', 'oob', 'oba', 'bar')
Contributing
See the CONTRIBUTING file.
License
MIT. Please refer to the LICENSE file in this repository.
统计信息
- 总下载量: 56
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-05