2017 © Pedro Peláez
 

library php-persian-natural-language-processor

Simple php and python wrapper on hazm persian text processor

image

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

Simple php and python wrapper on hazm persian text processor

  • Friday, December 1, 2017
  • by Mehrdad-Dadkhah
  • Repository
  • 1 Watchers
  • 1 Stars
  • 49 Installations
  • Python
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 513 % Grown

The README.md

php-persian-natural-language-processor

simple php and python wrapper on hazm persian text processor., (*1)

Software License Packagist Version, (*2)

System requirements

install hazm:, (*3)

if have not python:, (*4)

sudo apt install python, (*5)

then:, (*6)

sudo apt install python-pip, (*7)

and then:, (*8)

pip install hazm, (*9)

Installation

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

Usage

PHP:, (*10)

use MehrdadDadkhah\Language\PersianLanguageProcessor;

$parser = new PersianLanguageProcessor();

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

Python:, (*11)

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

and the result:, (*12)

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

  • 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., (*13)

Acknowledgments

Uses:, (*14)

License

php-persian-natural-language-processor is licensed under the GPLv3 License., (*15)

The Versions

01/12 2017

dev-master

9999999-dev https://github.com/Mehrdad-Dadkhah/php-persian-natural-language-processor

Simple php and python wrapper on hazm persian text processor

  Sources   Download

GPLv3

The Requires

 

by Mehrdad Dadkhah

language persian natural-processing

01/12 2017

1.0.0

1.0.0.0 https://github.com/Mehrdad-Dadkhah/php-persian-natural-language-processor

Simple php and python wrapper on hazm persian text processor

  Sources   Download

GPLv3

The Requires

 

by Mehrdad Dadkhah

language persian natural-processing