PHPackages                             mehrdad-dadkhah/php-persian-natural-language-processor - 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. mehrdad-dadkhah/php-persian-natural-language-processor

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

mehrdad-dadkhah/php-persian-natural-language-processor
======================================================

Simple php and python wrapper on hazm persian text processor

1.0.5(5y ago)34902GPL-3.0-or-laterPythonPHP &gt;=7.2

Since Dec 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Mehrdad-Dadkhah/php-persian-natural-language-processor)[ Packagist](https://packagist.org/packages/mehrdad-dadkhah/php-persian-natural-language-processor)[ Docs](https://github.com/Mehrdad-Dadkhah/php-persian-natural-language-processor)[ RSS](/packages/mehrdad-dadkhah-php-persian-natural-language-processor/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (1)Versions (7)Used By (0)

php-persian-natural-language-processor
======================================

[](#php-persian-natural-language-processor)

simple php and python wrapper on hazm persian text processor.

[![Software License](https://camo.githubusercontent.com/e1514dd3f2095dbf68a0008ae62a631142953ad2e86aa94c504343f2c2c191da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/949392fa0b036a78fec4c12d5f3b666720734ed6f2056d9721beb3da03a3d7f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4d6568726461642d4461646b6861682f7068702d7065727369616e2d6e61747572616c2d6c616e67756167652d70726f636573736f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Mehrdad-Dadkhah/PersianLanguageProcessor)

System requirements
-------------------

[](#system-requirements)

- [hazm](https://github.com/sobhe/hazm)

install hazm:

if have not python:

`sudo apt install python`

then:

`sudo apt install python-pip`

and then:

`pip install hazm`

Installation
------------

[](#installation)

```
composer require mehrdad-dadkhah/php-persian-natural-language-processor

```

Usage
-----

[](#usage)

PHP:

```
use MehrdadDadkhah\Language\PersianLanguageProcessor;

$parser = new PersianLanguageProcessor();

$parser->allNLP('سلام. این یک متن تست است. موفق باشید');
```

Python:

```
python /path/to/pr/processor.py allNLP json.dumps('سلام. این یک متن تست است. موفق باشید')
```

and the result:

```
array:7 [▼
  "chunksGroup" => array:2 [▼
    "main" => "[سلام NP] . [این یک متن تست NP] [است VP] . [موفق ADJP] [باشید VP]"
    "normalized" => "[سلام NP] . [این یک متن تست NP] [است VP] . [موفق ADJP] [باشید VP]"
  ]
  "postTags" => array:2 [▼
    "main" => array:10 [▶]
    "normalized" => array:10 [▼
      0 => array:2 [▶]
      1 => array:2 [▶]
      2 => array:2 [▶]
      3 => array:2 [▶]
      4 => array:2 [▼
        0 => "متن"
        1 => "N"
      ]
      5 => array:2 [▶]
      6 => array:2 [▶]
      7 => array:2 [▶]
      8 => array:2 [▶]
      9 => array:2 [▶]
    ]
  ]
  "stem" => array:2 [▼
    "main" => array:4 [▶]
    "normalized" => array:4 [▼
      "ADV" => []
      "N" => array:2 [▶]
      "Ne" => []
      "V" => array:3 [▶]
    ]
  ]
  "wordTokenize" => array:2 [▼
    "main" => array:10 [▶]
    "normalized" => array:10 [▼
      0 => "سلام"
      1 => "."
      2 => "این"
      3 => "یک"
      4 => "متن"
      5 => "تست"
      6 => "است"
      7 => "."
      8 => "موفق"
      9 => "باشید"
    ]
  ]
  "lemmatized" => array:2 [▼
    "main" => array:4 [▼
      "ADV" => []
      "N" => array:2 [▼
        0 => "سلام"
        1 => "متن"
      ]
      "Ne" => []
      "V" => array:3 [▼
        0 => "تست"
        1 => "است"
        2 => "بود#باش"
      ]
    ]
    "normalized" => array:4 [▼
      "ADV" => []
      "N" => array:2 [▼
        0 => "سلام"
        1 => "متن"
      ]
      "Ne" => []
      "V" => array:3 [▼
        0 => "تست"
        1 => "است"
        2 => "بود#باش"
      ]
    ]
  ]
  "normalized" => "سلام. این یک متن تست است. موفق باشید"
  "sentTokenize" => array:2 [▼
    "main" => array:3 [▶]
    "normalized" => array:3 [▼
      0 => "سلام."
      1 => "این یک متن تست است."
      2 => "موفق باشید"
    ]
  ]
]

```

---

functions
---------

[](#functions)

- normilizeText(string $text)
- sentTokenizeText(string $text)
- wordTokenizeText(string $text)
- postTagText(string $text)
- chunksText(string $text)
- getChunksGroup(string $text)
- stemText(string $text)
- lemmatizeText(string $text)
- allNLP(string $text)

allNLP function call all other functions and return all results.

Acknowledgments
---------------

[](#acknowledgments)

Uses:

- [sobhe/hazm](https://github.com/sobhe/hazm)
- [symfony/process](https://github.com/symfony/Process)

License
-------

[](#license)

php-persian-natural-language-processor is licensed under the [GPLv3 License](https://opensource.org/licenses/GPL-3.0).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~202 days

Recently: every ~21 days

Total

6

Last Release

2073d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.5

1.0.1PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3860685?v=4)[Mehrdad-Dadkhah](/maintainers/Mehrdad-Dadkhah)[@Mehrdad-Dadkhah](https://github.com/Mehrdad-Dadkhah)

---

Top Contributors

[![Mehrdad-Dadkhah](https://avatars.githubusercontent.com/u/3860685?v=4)](https://github.com/Mehrdad-Dadkhah "Mehrdad-Dadkhah (13 commits)")

---

Tags

language-processingnatural-language-processingpersianpersian-languagepersian-nlpphplanguagepersiannatural-processing

### Embed Badge

![Health badge](/badges/mehrdad-dadkhah-php-persian-natural-language-processor/health.svg)

```
[![Health](https://phpackages.com/badges/mehrdad-dadkhah-php-persian-natural-language-processor/health.svg)](https://phpackages.com/packages/mehrdad-dadkhah-php-persian-natural-language-processor)
```

###  Alternatives

[phpoption/phpoption

Option Type for PHP

2.7k541.2M159](/packages/phpoption-phpoption)[patrickschur/language-detection

A language detection library for PHP. Detects the language from a given text string.

8513.2M18](/packages/patrickschur-language-detection)[wapmorgan/morphos

A morphological solution for Russian and English language written completely in PHP. Provides classes to inflect personal names, geographical names, decline and pluralize nouns, generate cardinal and ordinal numerals, spell out money amounts and time.

8351.3M7](/packages/wapmorgan-morphos)[coderello/laravel-nova-lang

Language support for Laravel Nova.

4251.2M2](/packages/coderello-laravel-nova-lang)[snipe/banbuilder

Library to easily handle profanity filtering in PHP projects.

3371.5M3](/packages/snipe-banbuilder)[landrok/language-detector

A fast and reliable PHP library for detecting languages

132647.0k3](/packages/landrok-language-detector)

PHPackages © 2026

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