apie/count-words
最新稳定版本:1.0.0-RC2
Composer 安装命令:
composer require apie/count-words
包简介
Composer package of the apie library: count words
README 文档
README
count-words
This package is part of the Apie library. The code is maintained in a monorepo, so PR's need to be sent to the monorepo
Documentation
This small package contains a class to count words in a text. All words are returned lowercase.
Usage
use Apie\CountWords\WordCounter; var_dump(WordCounter::countFromString('This is the text with many words like the or and'));
This will echo:
array(10) {
["this"]=>
int(1)
["is"]=>
int(1)
["the"]=>
int(2)
["text"]=>
int(1)
["with"]=>
int(1)
["many"]=>
int(1)
["words"]=>
int(1)
["like"]=>
int(1)
["or"]=>
int(1)
["and"]=>
int(1)
}
It also supports reading (large) files as long the indexing does still fit in memory:
use Apie\CountWords\WordCounter; var_dump(WordCounter::countFromResource(fopen('large_file.txt', 'r')));
统计信息
- 总下载量: 6.93k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-29