masroore / stopwords
A PHP package to remove common stopwords from an input text, it covers most languages.
Installs: 2 998
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
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-10-12 20:39:05 UTC
README
Overview
Stopwords in multiple languages that you can easily use with your PHP applications.
Supported languages
Currently provides stopwords for the following languages:
- Arabic
- Azerbaijani
- Bengali
- Danish
- Dutch
- English
- Finnish
- French
- German
- Greek
- Hungarian
- Indonesian
- Italian
- Kazakh
- Nepali
- Norwegian
- Portuguese
- Romanian
- Russian
- Slovene
- Spanish
- Swedish
- Tajik
- Turkish
Installation
Requires PHP 8.0+
You can install the package via composer:
composer require masroore/stopwords
Usage
$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"
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Thank you for considering to contribute to Collision. All the contribution guidelines are mentioned here.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
Collision is an open-sourced software licensed under the MIT license.