PHP code example of antoinelame / pos-tagger

1. Go to this page and download the library: Download antoinelame/pos-tagger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

antoinelame / pos-tagger example snippets


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

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