1. Go to this page and download the library: Download nai-php/naipostagger 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/ */
nai-php / naipostagger example snippets
use NaiPosTagger\Pipelines\PipelinePosTagging;
use NaiPosTagger\Models\NaiPosArr;
per.php');
define('DICTIONARIES_PATH', __DIR__ . '/./dictionaries/dictionaries-');
define('TRAITS_PATH', __DIR__ . '/./vendor/nai-php/naipostagger/src/');
$sentence = 'my name is Fred';
$PipelinePosTagging = new PipelinePosTagging();
$PipelinePosTagging->language = 'en';
$pos_arr = $PipelinePosTagging->transform($sentence);
// for a clear output, better hide metadata
$pos_arr = NaiPosArr::clearMetadata($pos_arr);
// and further simplify the output
$pos_arr = NaiPosArr::flatPosArr($pos_arr);
diex($pos_arr);