php拼写检查

php安装pspell
查看版本
aspell -v
aspell dump dicts
aspell check temp_test_file.txt
但是没有任何语言包
其实他使用的是aspell或者说ispell
安装语言包
In centos:
yum install aspell-en
In FreeBSD:
pkg install en-aspell
就有了英文,其它语言
参考
https://ftp.gnu.org/gnu/aspell/dict/0index.html#unofficial

aspell官方
http://aspell.net/

使用时最简单的例子

<?php
$dict = pspell_new ("en");
if (!pspell_check ($dict, "carr")) {
    $suggestions = pspell_suggest ($dict, "carr");
     foreach ($suggestions as $suggestion) {
        echo "Did you mean: $suggestion?<br />";
     }
}
?>

编译方式安装语言包
ftp://ftp.gnu.org/gnu/aspell/dict/en/ 下载解压后,在其目录运行编译安装
./configure
make
make install

比如英文的语包

en
en-variant_0
en-variant_1
en-variant_2
en-w_accents
en-wo_accents
en_CA
en_CA-variant_0
en_CA-variant_1
en_CA-w_accents
en_CA-wo_accents
en_GB
en_GB-ise
en_GB-ise-w_accents
en_GB-ise-wo_accents
en_GB-ize
en_GB-ize-w_accents
en_GB-ize-wo_accents
en_GB-variant_0
en_GB-variant_1
en_GB-w_accents
en_GB-wo_accents
en_US
en_US-variant_0
en_US-variant_1
en_US-w_accents
en_US-wo_accents

参考:

http://hunspell.github.io/

https://www.cs.hmc.edu/~geoff/ispell.html

http://aspell.net/

https://www.php.cn/manual/view/5294.html

https://github.com/tigitz/php-spellchecker

https://www.lpology.com/code/spellcheck

https://www.php.net/manual/zh/ref.pspell.php

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注