PHPackages                             patrickschur/stanford-nlp-tagger - 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. patrickschur/stanford-nlp-tagger

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

patrickschur/stanford-nlp-tagger
================================

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

v0.3.0(5y ago)7429.3k—8.6%12[1 issues](https://github.com/patrickschur/stanford-nlp-tagger/issues)1MITPHPPHP ^7

Since Feb 6Pushed 5y ago7 watchersCompare

[ Source](https://github.com/patrickschur/stanford-nlp-tagger)[ Packagist](https://packagist.org/packages/patrickschur/stanford-nlp-tagger)[ Docs](https://github.com/patrickschur/stanford-nlp-tagger)[ RSS](/packages/patrickschur-stanford-nlp-tagger/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (1)Versions (6)Used By (1)

stanford-nlp-tagger
===================

[](#stanford-nlp-tagger)

[![Version](https://camo.githubusercontent.com/c7601bd8b11a99df4de1f3be660bf01ac99dce6dccf06473adc9e87d9546637b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061747269636b73636875722f7374616e666f72642d6e6c702d7461676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/patrickschur/stanford-nlp-tagger)[![Total Downloads](https://camo.githubusercontent.com/3152767ba5bccc99f75616e62db04e3c559dcbd2a138473228c0e84478ace7cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7061747269636b73636875722f7374616e666f72642d6e6c702d7461676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/patrickschur/stanford-nlp-tagger)[![Minimum PHP Version](https://camo.githubusercontent.com/33fb645b5df12784ff41246932f5c779a148065bcfe15e245178d047ca6593d1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e302d3441433531432e7376673f7374796c653d666c61742d737175617265)](http://php.net/)[![License](https://camo.githubusercontent.com/546a31d2fc472feaf333c357d6539633f79f9737ae6c3bf01eccaf93563218d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7061747269636b73636875722f7374616e666f72642d6e6c702d7461676765722e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)

A PHP wrapper for the Stanford Natural Language Processing library. Supports POSTagger and CRFClassifier. Loads automatically the right packages and detects the language of the given text.

Requirements
------------

[](#requirements)

- You have to install Java in version 1.8+ or higher.
- Download the right packages and extract them into the directory. (The script loads automatically the right packages, no matter where they are.)

Installation with Composer
--------------------------

[](#installation-with-composer)

```
$ composer require patrickschur/stanford-nlp-tagger
```

### Example

[](#example)

- Download the required packages for the POSTagger [here](https://nlp.stanford.edu/software/stanford-postagger-2018-10-16.zip) for English only or [here](https://nlp.stanford.edu/software/stanford-postagger-full-2018-10-16.zip) for Arabic, Chinese, French, Spanish, and German.
- Extract the (**.zip**) package into your directory. (Please do not rename the packages, only if you want to add this packages manually.)

```
$pos = new \StanfordTagger\POSTagger();

$pos->tag('My dog also likes eating sausage.');
```

Results in

```
My_PRP$ dog_NN also_RB likes_VBZ eating_JJ sausage_NN ._.

```

setOutputFormat()
-----------------

[](#setoutputformat)

There are three ways of output formats (**xml**, **slashTags** and **tsv**)

```
$pos = new \StanfordTagger\POSTagger();

$pos->setOutputFormat(StanfordTagger::OUTPUT_FORMAT_XML);

$pos->tag('My dog also likes eating sausage.');
```

Result as XML:

```

  My
  dog
  also
  likes
  eating
  sausage
  .

```

or use

```
$pos->setOutputFormat(StanfordTagger::OUTPUT_FORMAT_TSV);
```

for

```
My	PRP$
dog	NN
also	RB
likes	VBZ
eating	JJ
sausage	NN
.	.

```

setModel(), setJarArchive() and setClassfier()
----------------------------------------------

[](#setmodel-setjararchive-and-setclassfier)

All packages are loaded automatically but if you want to change that you can set them manually.

```
$pos = new \StanfordTagger\POSTagger();

$pos->setModel(__DIR__ . '/stanford-postagger-full-2018-10-16/models/english-bidirectional-distsim.tagger');

$pos->setJarArchive(__DIR__ . '/stanford-postagger-full-2018-10-16/stanford-postagger.jar');
```

CRFClassifier
-------------

[](#crfclassifier)

- For English only, download the required packages for the CRFClassifier [here](https://nlp.stanford.edu/software/stanford-ner-2018-10-16.zip).
- You have to download the language models separately:
    - [German models](https://nlp.stanford.edu/software/stanford-german-corenlp-2018-10-05-models.jar)
    - [Spanish models](https://nlp.stanford.edu/software/stanford-spanish-corenlp-2018-10-05-models.jar)
    - [Chinese models](https://nlp.stanford.edu/software/stanford-chinese-corenlp-2018-10-05-models.jar)
- Extract the (**.jar**) files if you downloaded a language model and add them into your directory.

### Example

[](#example-1)

```
$ner = new \StanfordTagger\CRFClassifier();

$ner->tag('Albert Einstein was a theoretical physicist born in Germany.');
```

```
Albert/PERSON Einstein/PERSON was/O theoretical/O physicist/O born/O in/O Germany/LOCATION./O

```

Contribute
----------

[](#contribute)

Feel free to contribute to this repository. Any help is welcome.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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 ~318 days

Total

5

Last Release

2163d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18181635?v=4)[Patrick Schur](/maintainers/patrickschur)[@patrickschur](https://github.com/patrickschur)

---

Top Contributors

[![patrickschur](https://avatars.githubusercontent.com/u/18181635?v=4)](https://github.com/patrickschur "patrickschur (13 commits)")[![daemonfire300](https://avatars.githubusercontent.com/u/135746?v=4)](https://github.com/daemonfire300 "daemonfire300 (1 commits)")[![PendingRSVP](https://avatars.githubusercontent.com/u/12242880?v=4)](https://github.com/PendingRSVP "PendingRSVP (1 commits)")

---

Tags

classifierlanguagenatural-language-processingnernlpphpposstanford-nlptaggerwrapperlanguagewrapperposnlpclassifiernatural language processingtaggerner

### Embed Badge

![Health badge](/badges/patrickschur-stanford-nlp-tagger/health.svg)

```
[![Health](https://phpackages.com/badges/patrickschur-stanford-nlp-tagger/health.svg)](https://phpackages.com/packages/patrickschur-stanford-nlp-tagger)
```

###  Alternatives

[rubix/ml

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

2.2k1.5M28](/packages/rubix-ml)[phpoption/phpoption

Option Type for PHP

2.7k579.0M176](/packages/phpoption-phpoption)[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k30.5M113](/packages/simplesoftwareio-simple-qrcode)[codewithkyrian/transformers

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

758267.3k9](/packages/codewithkyrian-transformers)[yooper/php-text-analysis

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

541420.5k4](/packages/yooper-php-text-analysis)[nlgen/nlgen

A library for creating recursive-descent natural language generators.

56202.6k](/packages/nlgen-nlgen)

PHPackages © 2026

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