mehrdad-dadkhah/php-persian-natural-language-processor
Composer 安装命令:
composer require mehrdad-dadkhah/php-persian-natural-language-processor
包简介
Simple php and python wrapper on hazm persian text processor
README 文档
README
simple php and python wrapper on hazm persian text processor.
System requirements
install hazm:
if have not python:
sudo apt install python
then:
sudo apt install python-pip
and then:
pip install hazm
Installation
composer require mehrdad-dadkhah/php-persian-natural-language-processor
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
- 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
Uses:
License
php-persian-natural-language-processor is licensed under the GPLv3 License.
mehrdad-dadkhah/php-persian-natural-language-processor 适用场景与选型建议
mehrdad-dadkhah/php-persian-natural-language-processor 是一款 基于 Python 开发的 Composer 扩展包,目前已累计 490 次下载、GitHub Stars 达 3, 最近一次更新时间为 2017 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「language」 「persian」 「natural-processing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mehrdad-dadkhah/php-persian-natural-language-processor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mehrdad-dadkhah/php-persian-natural-language-processor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mehrdad-dadkhah/php-persian-natural-language-processor 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Easy to use i18n translation PHP class for multi-language websites
Package for convenient work with Laravel's localization features
Store your language lines in the database, yaml or other sources
Set Links with a specific language parameter
Convert eloquent date attributes to jalali (Persian) dates on the fly. (supports model propery access, toJson, toString and toArray).
统计信息
- 总下载量: 490
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2017-11-29