malahierba-lab / word-counter
Laravel 简单的单词计数工具
    0.1.1
    2015-11-17 01:30 UTC
Requires
- php: >=5.5.18
- laravel/framework: 5.*
This package is not auto-updated.
Last update: 2024-09-14 18:47:27 UTC
README
Laravel 简单的单词计数工具。由 malahierba.cl 开发团队提供支持
安装
在您的 composer.json 中添加
{
    "require": {
        "malahierba-lab/word-counter": "0.*"
    }
}
然后您需要运行 composer update 命令。
使用
重要:为了说明文档的目的,以下示例中,我们始终假设您使用 use Malahierba\WordCounter; 将库导入到您的命名空间中
$wordcounter = new WordCounter;
// Load string to analize
$wordcounter->load('some text');
// Count all words
$total = $wordcounter->countTotalWords();
// Count each word
// You receive an array with objects:
// -> word
// -> count
$eachWord = $wordcounter->countEachWord();
//example to get info for each word
foreach ($eachWord as $item) {
    $word   = $item->word;
    $count  = $item->count;
}
许可证
此项目采用 MIT 许可证。有关更多信息,请阅读 LICENCE 文件。