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 2w ago

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 62% 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

2121d 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

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751284.3k37](/packages/civicrm-civicrm-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

672139.5k6](/packages/spatie-laravel-export)[illuminate/process

The Illuminate Process package.

44813.9k97](/packages/illuminate-process)

PHPackages © 2026

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