PHPackages                             molbi/php-text-analysis - 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. molbi/php-text-analysis

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

molbi/php-text-analysis
=======================

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

v1.1.0(9y ago)01.7k↓50%Apache 2PHPPHP &gt;=5.5

Since Sep 26Pushed 9y ago1 watchersCompare

[ Source](https://github.com/molbi/php-text-analysis)[ Packagist](https://packagist.org/packages/molbi/php-text-analysis)[ RSS](/packages/molbi-php-text-analysis/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (5)Used By (0)

php-text-analysis
=================

[](#php-text-analysis)

[![alt text](https://camo.githubusercontent.com/58ce8a87d57fb5b31505520c7bbdfad17b0f397f5a2d756aad14ce17a4d5aef4/68747470733a2f2f7472617669732d63692e6f72672f796f6f7065722f7068702d746578742d616e616c797369732e7376673f6272616e63683d6d6173746572 "Build status")](https://camo.githubusercontent.com/58ce8a87d57fb5b31505520c7bbdfad17b0f397f5a2d756aad14ce17a4d5aef4/68747470733a2f2f7472617669732d63692e6f72672f796f6f7065722f7068702d746578742d616e616c797369732e7376673f6272616e63683d6d6173746572)

[![Total Downloads](https://camo.githubusercontent.com/004055b9264cb23779b8850199ed73eaeaa121440d2fccdcb0d7f458d5126910/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d746578742d616e616c797369732f7068702d746578742d616e616c797369732e737667)](https://camo.githubusercontent.com/004055b9264cb23779b8850199ed73eaeaa121440d2fccdcb0d7f458d5126910/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d746578742d616e616c797369732f7068702d746578742d616e616c797369732e737667)

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language. All the documentation for this project can be found in the wiki.

Installation Instructions
=========================

[](#installation-instructions)

Add PHP Text Analysis to your project

```
composer require yooper/php-text-analysis

```

Documentation for the library resides in the wiki.

Dictionary Installation
=======================

[](#dictionary-installation)

Not required unless you use the dictionary stemmers

*For Ubuntu &lt; 16*

```
sudo apt-get install libpspell-dev
sudo apt-get install php5-pspell
sudo apt-get install aspell-en
sudo apt-get install php5-enchant

```

*For Ubuntu &gt;= 16*

```
sudo apt-get install libpspell-dev php7.0-pspell aspell-en php7.0-enchant

```

*For Centos*

```
sudo yum install php5-pspell
sudo yum install aspell-en
sudo yum install php5-enchant

```

*PHP Pecl Stem* is not currently available in php 7.0.

Tokenize
========

[](#tokenize)

There are several tokenizers available

- FixedLengthTokenizer
- GeneralTokenizer
- LambdaTokenizer
- PennTreeBankTokenizer
- RegexTokenizer
- SentenceTokenizer
- WhitespaceTokenizer

*Tokenizer Usage*

```
$tokenizer = new GeneralTokenizer()
$tokens = $tokenizer->tokenize("Enter your text here");

```

Frequency Distribution
======================

[](#frequency-distribution)

```
$tokenizer = new \TextAnalysis\Tokenizers\GeneralTokenizer();
$tokens = $tokenizer->tokenize("time flies like an arrow and an arrow flies like time");
$freqDist = new \TextAnalysis\Analysis\FreqDist($tokens);
$freqDist->getHapaxes(); //Get the Hapaxes
$freqDist->getTotalTokens();
$freqDist->getTotalUniqueTokens();

```

Check out the API for full documentation

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 95.1% 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 ~56 days

Total

3

Last Release

3410d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f0ca0dad1b82e8908dfc45d3a2b6cceb423c54f55b9d03cba8f44513d0b24e17?d=identicon)[molbi](/maintainers/molbi)

---

Top Contributors

[![yooper](https://avatars.githubusercontent.com/u/1064781?v=4)](https://github.com/yooper "yooper (116 commits)")[![molbi](https://avatars.githubusercontent.com/u/7512432?v=4)](https://github.com/molbi "molbi (6 commits)")

---

Tags

nlpnatural language processingirtext analysis

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/molbi-php-text-analysis/health.svg)

```
[![Health](https://phpackages.com/badges/molbi-php-text-analysis/health.svg)](https://phpackages.com/packages/molbi-php-text-analysis)
```

###  Alternatives

[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

539393.0k2](/packages/yooper-php-text-analysis)[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)[nlp-tools/nlp-tools

NlpTools is a set of php 5.3+ classes for beginner to semi advanced natural language processing work.

774645.2k5](/packages/nlp-tools-nlp-tools)[nlgen/nlgen

A library for creating recursive-descent natural language generators.

56181.3k](/packages/nlgen-nlgen)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)

PHPackages © 2026

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