如何在php中启用词干语言?

时间:2017-03-13 12:56:14

标签: php stem

我已经安装了porter stemmer:

pecl install stem

...

Compile Danish stemmer? [yes] : n
Compile Dutch stemmer? [yes] : n
Compile English stemmer? [yes] : y
Compile Finnish stemmer? [yes] : n
Compile French stemmer? [yes] : n
Compile German stemmer? [yes] : n
Compile Hungarian stemmer? [yes] : n
Compile Italian stemmer? [yes] : y
Compile Norwegian stemmer? [yes] : n
Compile Portuguese stemmer? [yes] : n
Compile Romanian stemmer? [yes] : n
Compile Russian stemmer? [yes] : y
Compile Russian (UTF8) stemmer? [yes] : y
Compile Spanish stemmer? [yes] : n
Compile Swedish stemmer? [yes] : n
Compile Turkish (UTF8) stemmer? [yes] : n

我添加了

extension=stem.so

php.ini文件末尾的字符串和...

service apache2 restart

但phpinfo告诉我:

stem
stem support    enabled
version     1.5.1
compiled as dynamic module
Languages Supported
Original Porter     enabled (default)
Danish  disabled
Dutch   disabled
English     disabled
Finnish     disabled
French  disabled
German  disabled
Hungarian   disabled
Italian     disabled
Norwegian   disabled
Portuguese  disabled
Romanian    disabled
Russian     disabled
Russian (Unicode)   disabled
Spanish     disabled
Swedish     disabled
Turkish (Unicode)   disabled 

...并且函数stem_english不存在。

如何启用语言?

P.S。:这个文本我必须插入以避免"看起来像代码"错误。版主可以删除它。

1 个答案:

答案 0 :(得分:1)

A-ha-ha,我应该输入"是"或"不",不" y"或" n"。解决方案是:

pecl stem uninstall 
pecl stem install

Compile Danish stemmer? [yes] : no
Compile Dutch stemmer? [yes] : no
Compile English stemmer? [yes] : yes
Compile Finnish stemmer? [yes] : no
Compile French stemmer? [yes] : no
Compile German stemmer? [yes] : no
Compile Hungarian stemmer? [yes] : no
Compile Italian stemmer? [yes] : yes
Compile Norwegian stemmer? [yes] : no
Compile Portuguese stemmer? [yes] : no
Compile Romanian stemmer? [yes] : no
Compile Russian stemmer? [yes] : yes
Compile Russian (UTF8) stemmer? [yes] : yes
Compile Spanish stemmer? [yes] : no
Compile Swedish stemmer? [yes] : no
Compile Turkish (UTF8) stemmer? [yes] : no