PHP code example of mehrdad-dadkhah / php-persian-natural-language-processor
1. Go to this page and download the library: Download mehrdad-dadkhah/php-persian-natural-language-processor library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mehrdad-dadkhah / php-persian-natural-language-processor example snippets
use MehrdadDadkhah\Language\PersianLanguageProcessor;
$parser = new PersianLanguageProcessor();
$parser->allNLP('سلام. این یک متن تست است. موفق باشید');
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 => "موفق باشید"
]
]
]