当前位置: 首页 > 工具软件 > SCWS > 使用案例 >

php安装SCWS中文分词扩展

施同
2023-12-01

SCWS-1.2.3 中文分词扩展安装(http://www.xunsearch.com/scws/docs.php#instscws)

 安装 libscws 这套 C-API

  wget http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2

  tar xvjf scws-1.2.3.tar.bz2

  cd scws-1.2.3

  ./configure --prefix=/usr/local/scws

  make && make install

  cd  /usr/local/scws

  ls -al /usr/local/scws/lib/libscws.la  查看是否安装成功

  /usr/local/scws/bin/scws -h  查看是否安装成功

 

 安装词典

  wget http://www.xunsearch.com/scws/down/scws-dict-chs-gbk.tar.bz2

  wget http://www.xunsearch.com/scws/down/scws-dict-chs-utf8.tar.bz2

  tar xvjf scws-dict-chs-gbk.tar.bz2

  tar xvjf scws-dict-chs-utf8.tar.bz2

  再将 *.xdb 放入 /usr/local/scws/etc

  

 安装PHP扩展(前面操作必须有)

  cd  解压目录/phpext/

  /usr/local/php/bin/phpize

  ./configure --with-scws=/usr/local/scws --with-php-config=/usr/local/php/bin/php-config

  make && make install

  vim /usr/local/php/etc/php.ini

   extension = scws.so

   ;scws.default.charset = gbk

   scws.default.charset = utf8

   scws.default.fpath = /usr/local/scws/etc

   

  php -m 查看拓展

 类似资料: