PHPackages                             nai-php/naipostagger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nai-php/naipostagger

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nai-php/naipostagger
====================

A part of speech tagger written in PHP.

v0.2(4y ago)141342[2 issues](https://github.com/nai-php/NaiPosTagger/issues)MITPHPPHP &gt;=7.2.0

Since Aug 4Pushed 4y ago2 watchersCompare

[ Source](https://github.com/nai-php/NaiPosTagger)[ Packagist](https://packagist.org/packages/nai-php/naipostagger)[ RSS](/packages/nai-php-naipostagger/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (2)Versions (4)Used By (0)

N-ai php pos tagger
===================

[](#n-ai-php-pos-tagger)

A lightweight framework-agnostic library in pure PHP for part-of-speech tagging. Can be used for chatbots, personal assistants, keywords extraction etc. Being written in PHP, it can be easily integrated in pre existent or new applications, giving the real ability to understand what users write.

It is based on vocabularies and predefined grammatical rules, without wrappers to third part systems, neural networks, machine learning or models that requires huge resources.

This is the english version. Documentation and TODO are coming, more info and demo on [n-ai.cloud](https://www.n-ai.cloud)

Precision
---------

[](#precision)

In this table I'll put results of differents type of sentences corpus.

CorpusTotal tokensCorrectly taggedNot correctly tagged% of total correct"Just Shoot Me" movie subtitles340333812299,35Installation
------------

[](#installation)

1. in your project folder e.g. "*myproject*" install the package via [composer](https://packagist.org/packages/nai-php/naipostagger);
2. create folder "*dictionaries*";
3. inside folder "*dictionaries*" clone or download the [english dictionary](https://github.com/nai-php/databases.git) repository;
4. run this example script:

```
use NaiPosTagger\Pipelines\PipelinePosTagging;
use NaiPosTagger\Models\NaiPosArr;

include('vendor/autoload.php');

include(__DIR__ . '/vendor/nai-php/naipostagger/src/Utilities/common_functions_helper.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);
```

And the output will be:

```
Array
(
    [0] => Array
        (
            [form] => .
            [lemma] => .
            [features] => SENT
            [sh-feat] => SENT
            [label] =>
            [rule] =>
            [pos_score] => 0
        )

    [1] => Array
        (
            [form] => my
            [lemma] => my
            [features] => ADJ:pos+m+s
            [sh-feat] => ADJ
            [label] =>
            [rule] =>
            [pos_score] => 0
        )

    [2] => Array
        (
            [form] => name
            [lemma] => name
            [features] => NOUN-m:s
            [sh-feat] => NOUN
            [label] =>
            [rule] =>
            [pos_score] => 0
        )

    [3] => Array
        (
            [form] => is
            [lemma] => is
            [features] => VER:ind+pres+3+s
            [sh-feat] => VER
            [label] =>
            [rule] =>
            [pos_score] => 0
        )

    [4] => Array
        (
            [form] => Fred
            [lemma] => Fred
            [features] => NPR
            [sh-feat] => NPR
            [label] =>
            [rule] =>
            [pos_score] => 0
        )

    [5] => Array
        (
            [form] => .
            [lemma] => .
            [features] => SENT
            [sh-feat] => SENT
            [label] =>
            [rule] =>
            [pos_score] => 0
        )

)
```

To do list
----------

[](#to-do-list)

- Find contributors
- Clean, check, fix and tag term in dictionaries
- Clean, check, fix brill rules
- Add more ngrams
- Add more tests, expecially for filters
- Collect and load frill words
- Better Oop for some classes?
- In module for logical analysis (yet not published) collect synonyms and temporal expressions

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 93.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~18 days

Total

2

Last Release

1721d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4fb4710ef3c30595f4fc62d7d7740fb0269443c692b7eee692d29ddb05dac8f6?d=identicon)[nai-php](/maintainers/nai-php)

---

Top Contributors

[![nai-php](https://avatars.githubusercontent.com/u/88245654?v=4)](https://github.com/nai-php "nai-php (44 commits)")[![lsv](https://avatars.githubusercontent.com/u/20708?v=4)](https://github.com/lsv "lsv (3 commits)")

---

Tags

aichatbotkeyword-extractionlinguisticsnatural-language-processingparts-of-speechpos-taggingsemanticaisemantictagkeywordsposchatbotnatural language processinglinguisticspart of speechpos tagging

### Embed Badge

![Health badge](/badges/nai-php-naipostagger/health.svg)

```
[![Health](https://phpackages.com/badges/nai-php-naipostagger/health.svg)](https://phpackages.com/packages/nai-php-naipostagger)
```

###  Alternatives

[rubix/ml

A high-level machine learning and deep learning library for the PHP language.

2.2k1.4M28](/packages/rubix-ml)[codewithkyrian/transformers

State-of-the-art Machine Learning for PHP. Run Transformers in PHP

749231.8k5](/packages/codewithkyrian-transformers)[nlgen/nlgen

A library for creating recursive-descent natural language generators.

56181.3k](/packages/nlgen-nlgen)[patrickschur/stanford-nlp-tagger

PHP wrapper for the Stanford Natural Language Processing library. Supports POSTagger and CRFClassifier.

7426.7k1](/packages/patrickschur-stanford-nlp-tagger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
