我想在我的程序中使用PHP的PSpell檢查功能。 pspell_check()
中是否有一個用於區分大小寫檢查的選項?不區分大小寫拼寫檢查?
0
A
回答
4
我發現了一種解決大小寫不靈敏的選項。 PSpell的建議功能似乎總是返回一個錯誤大寫的字作爲它的第一個建議的大小寫正確,所以我們可以檢查這個如果初始拼寫檢查失敗:
<?php
function pspell_icheck($dictionary_link, $word) {
return (pspell_check($dictionary_link, $word) ||
strtolower(reset(pspell_suggest($dictionary_link, $word))) == strtolower($word));
}
$dict = pspell_new('en');
$word = 'foo';
echo pspell_icheck($dict, $word);
?>
在PHP 5.3.2作品。快樂編碼:)
1
試試這個補丁http://code.google.com/p/patched-pspell/。它使您可以設置任何選項。
pspell_config_set($pspell_config, 'ignore-case', 'true');
0
有一個簡單的解決方案。只要這樣做:
$word = ucfirst($word); //Always capitalize to avoid case sensitive error
if (!pspell_check($dict, $word)) {
$suggestions = pspell_suggest($dictionary, $word);
}
相關問題
- 1. 檢查不區分大小寫
- 2. 檢查不區分大小寫jQuery中
- 3. 如何在不區分大小寫的情況下檢查Hunspell中的拼寫
- 4. 如果存在檢查大小寫區分大小寫
- 5. 密碼區分大小寫檢查
- 6. 區域不區分大小寫查詢
- 7. 區分大小寫區分大小寫還是全大寫?
- 8. 區分大小寫查詢
- 9. 使區分大小寫不敏感的區分大小寫表
- 10. 區分大小寫的URL不區分大小寫
- 11. VB.NET不區分大小寫;很好的區分大小寫?
- 12. Lucene如何區分大小寫和不區分大小寫
- 13. 爲什麼區分大小寫和不區分大小寫?
- 14. Solr中對大小寫不敏感的拼寫檢查
- 15. 不區分大小寫
- 16. 不區分大小寫preg_replace_callback
- 17. distinctUnionOfObjects不區分大小寫
- 18. 不區分大小寫
- 19. System.IO.FileInfo不區分大小寫
- 20. MySQL不區分大小寫
- 21. 不區分大小寫Func
- 22. 不區分大小寫#define
- 23. 不區分大小寫OptionParser
- 24. FirebirdSql不區分大小寫
- 25. 不區分大小寫
- 26. CEDET:不區分大小寫?
- 27. SOLR不區分大小寫
- 28. 不區分大小寫QueryExpression
- 29. 不區分大小寫Restriction.IN
- 30. Zend_Controller_Router_Route_Regex不區分大小寫