We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thank you for sharing your work.
How can I implement stopwords?
The text was updated successfully, but these errors were encountered:
You can pass in your own tokenizer function in the constructor. Something like.
tokenizer
// array containing stopwords $stopwords = array("der", "die", "das", "the"); // escape the stopword array and implode with pipe $s = '~^\W*('.implode("|", array_map("preg_quote", $stopwords)).')\W+\b|\b\W+(?1)\W*$~i'; $options['tokenizer'] = function($text) use ($s) { // convert everything to lowercase $text = mb_strtolower($text); // remove stop words $text = preg_replace($s, '', $text); // split the words preg_match_all('/[[:alpha:]]+/u', $text, $matches); // first match list of words return $matches[0]; }; $classifier = new \niiknow\Bayes($options);
Sorry, something went wrong.
Perfect. Thank you
No branches or pull requests
Thank you for sharing your work.
How can I implement stopwords?
The text was updated successfully, but these errors were encountered: