佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 812|回复: 2

PSPELL 功能[RESOLVED]

[复制链接]
发表于 1-10-2006 10:31 PM | 显示全部楼层 |阅读模式
Hi everybody,

Good afternoon, I can't find error on my PHP coding, what is it happening on my coding??

In my php.ini:
extension=php-4.4.0_magickwand_q8_st.dll
;extension=aspell-15.dll
;extension=pspell-15.dll
;extension=php_mbstring.dll
;extension=php_bz2.dll
;extension=php_cpdf.dll
;extension=php_crack.dll
;extension=php_curl.dll
;extension=php_db.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_dbx.dll
;extension=php_domxml.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_hyperwave.dll
;extension=php_iconv.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_java.dll
;extension=php_ldap.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_msql.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_pdf.dll
;extension=php_pgsql.dll
;extension=php_printer.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_sybase_ct.dll
;extension=php_w32api.dll
;extension=php_xmlrpc.dll
;extension=php_xslt.dll
;extension=php_yaz.dll
;extension=php_zip.dll


In my function.php:

class spell_checker {
   var $personal_path = "c:\Aspell\dict";
   var $skip_len      = 3;
   var $mode = PSPELL_NORMAL;
   var $pspell_handle;
   var $pspell_cfg_handle;
   var $personal = false;
   function spell_checker($dict = "en", $pconfig = "" {
      $pspell_cfg_handle = pspell_config_create($dict);
      pspell_config_ignore($pspell_cfg_handle,$skip_len);
      pspell_config_mode($pspell_cfg_handle, $mode);
      if($pconfig != "" {
         $pspell_handle = pspell_config_personal($pspell_cfg_handle, $personal_path.$pconfig.".pws";
         $personal = true;
      }
      $pspell_handle = pspell_new_config($pspell_cfg_handle);
   }

Then i find this error :

Fatal error: Call to undefined function: pspell_config_create()

trying to do a spelling checking module, but encounter problem, any one could kindly lay their expensive helping hand and time on me?? Really thanks if one of u have suggestion..

have a nice day everyone.

[ 本帖最后由 Kal1983 于 3-10-2006 09:06 PM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 3-10-2006 12:04 AM | 显示全部楼层
hi everyone,

Its' me again. After browsing through GNU Aspell i found that actually the Aspell actually needs a dictionary word list which is include in the GNU aspell folder shared public..  After I try to install the Aspell (DOS application works fine, but the PHP file has problem, which is:

Warning: PSPELL couldn't open the dictionary. reason: No word lists can be found for the language "en".

my spelling checking class is something like (copy from zend.com):
class spell_checker {
   var $personal_path = "c:\Aspell\dict";
   var $skip_len      = 3;
   var $mode = PSPELL_NORMAL;
   var $pspell_handle;
   var $pspell_cfg_handle;
   var $personal = false;
   function spell_checker($dict = "en", $pconfig = "") {
      $pspell_cfg_handle = pspell_config_create($dict);
      pspell_config_ignore($pspell_cfg_handle,$skip_len);
      pspell_config_mode($pspell_cfg_handle, $mode);
      if($pconfig != "") {
         $pspell_handle = pspell_config_personal($pspell_cfg_handle, $personal_path.$pconfig.".rws");
         $personal = true;
      }
      $pspell_handle = pspell_new_config($pspell_cfg_handle);
          echo $pspell_handle;
   }
   function check($word) {
      return pspell_check($this->pspell_handle, $word);
   }

   function suggest($word) {
      return pspell_suggest($this->pspell_handle, $word);
   }

   function add($word) {
      if(!$personal) return false;
      return pspell_add_to_personal($this->pspell_handle, $word);
   }

   function close() {
      if(!$personal) return;
      return pspell_save_wordlist($this->pspell_handle);
   }

};
and i try it using (copy from zend.com):

   require_once("function.php");
   $spell_chk = new spell_checker("en", "zend_john");

   $spell_chk->add('ttest');

   $mystr = "This is a ttest of a mispellled word";

   $words = split("[^[:alpha:]']+", $mystr);

   foreach($words as $val) {

      if($spell_chk->check($val)) {

         echo "The word '$val' is spelled correctly<BR>";
      } else {

         echo "The word '$val' was not spelled correctly<BR>";
         echo "Possible correct spellings are: ";

         foreach($spell_chk->suggest($val) as $suggestion) {

            echo ' '.$suggestion;

         }

         echo "<BR>";

      }

    }

    $spell_chk->close();

Then all the error has come out, any high hand can help me???
Thanks for reading..
回复

使用道具 举报

 楼主| 发表于 3-10-2006 12:15 AM | 显示全部楼层
hi everyone,

Its' me again. After browsing through GNU Aspell i found that actually the Aspell actually needs a dictionary word list which is include in the GNU aspell folder shared public..  After I try to install the Aspell (DOS application works fine, but the PHP file has problem, which is:

Warning: PSPELL couldn't open the dictionary. reason: No word lists can be found for the language "en".

my spelling checking class is something like (copy from zend.com):
class spell_checker {
   var $personal_path = "c:\Aspell\dict";
   var $skip_len      = 3;
   var $mode = PSPELL_NORMAL;
   var $pspell_handle;
   var $pspell_cfg_handle;
   var $personal = false;
   function spell_checker($dict = "en", $pconfig = "") {
      $pspell_cfg_handle = pspell_config_create($dict);
      pspell_config_ignore($pspell_cfg_handle,$skip_len);
      pspell_config_mode($pspell_cfg_handle, $mode);
      if($pconfig != "") {
         $pspell_handle = pspell_config_personal($pspell_cfg_handle, $personal_path.$pconfig.".rws");
         $personal = true;
      }
      $pspell_handle = pspell_new_config($pspell_cfg_handle);
          echo $pspell_handle;
   }
   function check($word) {
      return pspell_check($this->pspell_handle, $word);
   }

   function suggest($word) {
      return pspell_suggest($this->pspell_handle, $word);
   }

   function add($word) {
      if(!$personal) return false;
      return pspell_add_to_personal($this->pspell_handle, $word);
   }

   function close() {
      if(!$personal) return;
      return pspell_save_wordlist($this->pspell_handle);
   }

};
and i try it using (copy from zend.com):

   require_once("function.php");
   $spell_chk = new spell_checker("en", "zend_john");

   $spell_chk->add('ttest');

   $mystr = "This is a ttest of a mispellled word";

   $words = split("[^[:alpha:]']+", $mystr);

   foreach($words as $val) {

      if($spell_chk->check($val)) {

         echo "The word '$val' is spelled correctly<BR>";
      } else {

         echo "The word '$val' was not spelled correctly<BR>";
         echo "Possible correct spellings are: ";

         foreach($spell_chk->suggest($val) as $suggestion) {

            echo ' '.$suggestion;

         }

         echo "<BR>";

      }

    }

    $spell_chk->close();

Then all the error has come out, any high hand can help me???
Thanks for reading..
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 14-11-2024 08:38 PM , Processed in 0.138397 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表