apie/count-words 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Latest Stable Version Total Downloads Latest Unstable Version License PHP Composer

PHP Composer

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-29