antoinelame / pos-tagger
Part-of-speech tagging in PHP
Installs: 129
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/antoinelame/pos-tagger
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-10-25 01:26:00 UTC
README
A really simple POS tagger for PHP (Part-of-speech tagging).
Analyze a word
use AntoineLame\PosTagger; $tagger = new PosTagger; // 🍎 $apple = $tagger->token('apple'); $apple->isVerb(); // false $apple->isNoun(); // true $apple->isSingularNoun(); // true $apple->isPluralNoun(); // false // 🚶 $walk = $tagger->token('walk'); $walk->isVerb(); // true $walk->isNoun(); // true $walk->isAdverb(); // false
Analyze a sentence
use AntoineLame\PosTagger; $tagger = new PosTagger; $tokens = $tagger->sentence('One giant leap for mankind'); $tokens[0]->token; // 'one' $tokens[4]->token; // 'mankind' $tokens[4]->isNoun(); // true
Available methods
isNoun()isSingularNoun()isPluralNoun()isAdverb()isVerb()isAdjective()isInterjection()
Credits
Thanks to ekinhbayar for her Brown Corpus.