[指南] Spring Context下使用"庖丁解牛"

25 views
Skip to first unread message

Qieqie

unread,
Aug 8, 2007, 10:06:18 PM8/8/07
to Paoding's Knives
Spring Context下使用"庖丁解牛":


1)paoding-analysis.properties配置文件放到classpath下,注意要在该文件中配置好词典安装目录
2)在原来的ApplicationContext-xxx.xml文件中,或新创建一个ApplicationContext-xxx.xml文件中
包含以下三个bean的配置

<bean id="writerAnalyzer"
class="net.paoding.analysis.analyzer.PaodingAnalyzer">
<property name="knife" ref="paoding"/>
<property name="mode" value="1"/>
</bean>

<bean id="queryAnalyzer"
class="net.paoding.analysis.analyzer.PaodingAnalyzer">
<property name="knife" ref="paoding"/>
<property name="mode" value="2"/>
</bean>

<bean id="paoding"
class="net.paoding.analysis.knife.PaodingMaker" factory-method="make"/
>

3) 建立索引时,使用writerAnalyzer (尽量多切词语);检索时可以使用queryAnalyzer(最大切词)


注1:paoding bean的配置方法可以更加灵活,不过仅当上面这种简单方法满足不了时,再去深入探寻。

注2:writerAnalyzer和queryAnalyzer现在mode是一个整型数,这在配置上不是很易读,2.0.0版本只能如此,但之后的
版本可以除了直接配置整型数,还可以这样设置: <property name="mode" value="writer"/>、
<property name="mode" value="query"/>

Qieqie

unread,
Aug 8, 2007, 10:12:18 PM8/8/07
to Paoding's Knives
帖子中的xml看起来不是很整齐, 大家可以参考JavaEye上的"镜像":

http://analysis.group.javaeye.com/group/post/15584

Reply all
Reply to author
Forward
0 new messages