belniakmedia/hunspell-php
Composer 安装命令:
composer require belniakmedia/hunspell-php
包简介
Hunspell PHP wrapper
README 文档
README
Forked from johnzuk/HunspellPHP
Version 4.x (Optimization +Batch Mode)
This version changes find() and possibly stem() (I'm not exactly sure how stem() functioned before as I did not use it, but I updated to be compatible with the changes made under the hood to hunspellSuggest()). The changes to hunspellSuggest() can now take a space-separated string of words to batch process. This change allows a single process call to handle many spell checks (and stems) rather than having to invoke the process once for each word. The update also ensures the 1000ms timeout "deadline" is not forcing the process to wait that time before ending which appeared to be the case in previous versions.
Version 3.0.0 (Very minor backward breaking change)
This version updates the constructor signature with a different (better?) default value for $encoding, so if anyone was using that this would be a backward breaking change. Otherwise, a new constructor argument $custom_word_file (path) has been added and will bind your provided custom word list with your dictionary in real time.
The other change this version takes care of is using proc_open and better env/encoding handling in general. We also now emmit an error_log() call so stderr output from the hunspell process are logged properly.
Version 2.x
Version 2.0.0 and above requires PHP ^8.0.0 and includes an important fix to the result matcher regex. If you need this for an older version of PHP I recommend that you fork 1.2 and update the regex matcher property of the Hunspell class to what is set in the current version of the code.
The reason for this fork
This project was initially forked because the shell commands used were for a non-bash shell. This fork's main purpose was to convert the shell commands to a BASH compatible syntax and add support for Windows powershell. As such this fork will not work correctly outside of a bash or powershell environment.
An additional change was made to the parsing of the return value as the PHP_EOL value used in the original source was not working in my testing. This was changed to "\n" which resolved the issue.
Example
$hunspell = new \HunspellPHP\Hunspell(); var_dump($hunspell->find('otwórz'));
belniakmedia/hunspell-php 适用场景与选型建议
belniakmedia/hunspell-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 61 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 belniakmedia/hunspell-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 belniakmedia/hunspell-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 61
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-21