1 Star 1 Fork 0

liupan / pscws4

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

基于PSCWS4的中文分词工具

词库官方网址:http://www.xunsearch.com/scws/
这是用纯 PHP 代码实现的 C 版 Libscws 的全部功能,即第四版的 PSCWS
PSCWS4 使用文档:http://www.xunsearch.com/scws/docs.php#pscws4


安装

composer require salliyme/pscws4

使用

/**
 * SCWS中文分词
 *
 * @param string $text 分词字符串
 * @param number $number 权重高的词数量(默认5个)
 * @param string $type 返回类型,默认字符串
 * @param string $delimiter 分隔符
 * @return string|array 字符串|数组
 */
$scws = new Scws();
$scws -> scws('能做到柔和、善解、忍辱,才有办法与人结好缘。——证严法师《静思语》');

运行结果

静思 善解 法师 柔和 做到

其它说明

  1. 默认返回结果为字符串,返回字符串支持自定义分隔符,默认为空格
  2. 支持返回结果为数组
  3. 支持返回词数量自定义,默认为5个

版权申明:这里只是把PSCWS4封装成composer包,词库版权属于原作者

MIT License Copyright (c) 2023 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于PSCWS4的中文分词工具 展开 收起
PHP
MIT
取消

发行版 (3)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/liupan2022/pscws4.git
git@gitee.com:liupan2022/pscws4.git
liupan2022
pscws4
pscws4
master

搜索帮助