masroore / stopwords
一个用于从输入文本中移除常用停用词的PHP包,它涵盖了大多数语言。
1.0.2
2022-06-12 12:33 UTC
Requires
- php: ^8.0 || ^8.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-12 20:27:42 UTC
README
概述
支持多种语言的停用词,您可以在PHP应用程序中轻松使用。
支持语言
目前提供以下语言的停用词
- 阿拉伯语
- 阿塞拜疆语
- 孟加拉语
- 丹麦语
- 荷兰语
- 英语
- 芬兰语
- 法语
- 德语
- 希腊语
- 匈牙利语
- 印度尼西亚语
- 意大利语
- 哈萨克语
- 尼泊尔语
- 挪威语
- 葡萄牙语
- 罗马尼亚语
- 俄语
- 斯洛文尼亚语
- 西班牙语
- 瑞典语
- 塔吉克语
- 土耳其语
安装
需要 PHP 8.0+
您可以通过composer安装此包
composer require masroore/stopwords
用法
$stopwords = new Kaiju\Stopwords\Stopwords(); // get the list of available languages print_r($stopwords->getLanguages()); // load stopwords for a language $stopwords->load('english'); // load stopwords for multiple languages $stopwords->load(['english', 'french']); // load stopwords for all available languages $stopwords->load('*'); // check if the given word is a stop-word $stopwords->isStopword('the'); // TRUE $stopwords->isStopword('America'); // FALSE // return a tokenized copy of the text, with stop-words and punctuation marks removed $text = "Good muffins cost $3.88\nin New York. Please buy me two of them.\n\nThanks!\n"; print_r($stopwords->strip($text)); // ["Good","muffins","cost","$3.88","New","York","Please","buy","two","Thanks"] echo $stopwords->clean($text); // "Good muffins cost $3.88 New York Please buy two Thanks"
测试
composer test
变更日志
有关最近更改的更多信息,请参阅变更日志。
贡献
感谢您考虑为Collision做出贡献。所有贡献指南均在此处说明。
安全漏洞
请查阅我们关于如何报告安全漏洞的安全策略。
鸣谢
许可证
Collision是一个开源软件,根据MIT许可证授权。