PHP敏感詞過濾【整理實踐版】

因爲國內互聯網管制政策,強大的敏感詞過濾系統成爲了每個網站必須具有的基本功能,尤爲是那些涉及UGC內容的站點。 對敏感詞過濾流行的方案是基於Double-array trie tree,更復雜的採用了「多模式匹配算法」,只不過Double-array trie tree性能已經足以知足項目須要,所以找了一個基於Double-array trie tree算法的開源項目知足項目目前須要。 大部分的Double-array trie tree項目都採用了 libdatrie http://linux.thai.net/~thep/datrie/datrie.htmlphp

操做系統:CentOS

1. 安裝libevent

http://monkey.org/~provos/libevent/html

# 未安裝執行
yum install libevent.x86_64  libevent-devel.x86_64 libevent.i686  libevent-devel.i686

二、安裝libiconv

因爲libdatrie依賴於libiconv來實現編碼轉換,所以必須安裝libiconvlinux

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
tar zxvf libiconv-1.15.tar.gz
cd libiconv-1.15
./configure
make
make install

2.安裝libdatrie http://linux.thai.net/~thep/datrie/datrie.html算法

wget  ftp://linux.thai.net/pub/ThaiLinux/software/libthai/libdatrie-0.2.12.tar.xz
tar xvJf  libdatrie-0.2.12.tar.xz
cd libdatrie-0.2.12
./configure CFLAGS=-liconv
make
make install

參照 http://blog.sina.com.cn/s/blog_5921b17e010168xu.htmlphp-fpm

php-fpm多版本支持 https://blog.csdn.net/zhangfeng1133/article/details/78149653性能

相關文章
相關標籤/搜索