zhangmt / jcseg

Automatically exported from code.google.com/p/jcseg
0 stars 0 forks source link

为什么修改了lexicon.dir之后. 词库子目录依然是默认的? (已解决) #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
jcseg.properties:
lexicon.dir=dic

com.webssky.jcseg.core.LexiconException: lexicon path 
[/Development/java/testJcseg/lexicon] does'n exists.

如上. 抛出了异常. 错误里面的子目录没有变. 配置未生效. 
但是lexicon.path已经生效了. 

Original issue reported on code.google.com by ase...@gmail.com on 5 Jul 2013 at 4:17

GoogleCodeExporter commented 9 years ago
上面的问题解决了. 是我写错了配置项.

配置文件能不能像log4j那样给一个类来指定配置文件路径. 
项目大. 配置文件是统一规划的. 
比如加一个configure方法来用指定绝对路径的文件配置分词器?

另外. 这个分词器所有的创建方式都不是线程安全的吗? 

PS. 很不错的开源分词器. 感谢分享. 
用了太多不靠谱的东西终于找到我想要的了.

Original comment by ase...@gmail.com on 5 Jul 2013 at 5:10

GoogleCodeExporter commented 9 years ago
我也是考虑到了一个这样的问题才把配置放在了一个单独的��
�置文件中. 确实有个不好的地方就是: 
jcseg.properties配置文件只能放在指定的一些路径下, 
大项目可能需要一起维护配置, 确实不怎么方便. 
我会考虑在下一个版本中加入你说的功能.

Original comment by chenxin6...@gmail.com on 6 Jul 2013 at 2:19

GoogleCodeExporter commented 9 years ago
jcseg目前创建的分词实例都是非线程安全的, 
但是这并不影响你的使用, 
不同的线程创建不同的ISegment分词对象即可, 
同时共用线程安全的词库实例(lucene和solr内部接口就是这样的
). 

如果对一个ISegment对象多线程调用就不能保证分词的顺序, 
要实现多线程调用一个ISegment分词对象还需要做一个中间存储
过程. 

如果你想实现多线程也可以: 

你可以把要分词的流拆分下, 
然后创建多个ISegment对象在不同的线程下工作, 
每个ISegment负责对一个拆分得到的流进行切分. 
这多个ISegment分词对象共用同一个词库.

jcseg后续会自带这种功能, 目前需要开发者自己开发.

Original comment by chenxin6...@gmail.com on 6 Jul 2013 at 2:30

GoogleCodeExporter commented 9 years ago
我爱beijing天安门

上面在分词时,我给系统加了一个词条:beijing天安门

混合词的中文词数我也改了,可这个混合词还是不能识别

我用API加的,没有加在词库文件中

Original comment by ase...@gmail.com on 6 Jul 2013 at 2:34

GoogleCodeExporter commented 9 years ago
PS: 哈, 感谢哥们的夸奖. ^0_0^

Original comment by chenxin6...@gmail.com on 6 Jul 2013 at 2:35

GoogleCodeExporter commented 9 years ago
这个是可以的.

jcseg>> 我爱beijing天安门
分词结果:
爱 beijing天安门
Done, total:12, split:2, cost: 0.00026sec

1. 确保你添加的词条是在MIXED_WORD词库中. 即: 
dic.add(ILexicon.MIXED_WORD, "beijing天安门")

2. 确保jcseg.properties中的mixcnlen大于等于3 
(或者你调用config.setMixCnLength(3)也行)

Original comment by chenxin6...@gmail.com on 6 Jul 2013 at 2:42

GoogleCodeExporter commented 9 years ago
加错分类了。。。。。

非常感谢耐心解答我的问题!

Original comment by ase...@gmail.com on 6 Jul 2013 at 3:15

GoogleCodeExporter commented 9 years ago
对啦. 能否考虑增加对希腊字母的识别? 比如δ β. 
医学词条很多都有这东西.

Original comment by ase...@gmail.com on 6 Jul 2013 at 3:20

GoogleCodeExporter commented 9 years ago
这类字母使用比较少. 
我考虑把他纳入标点符号的检查范围就应该可以实现正确的��
�词. 

假如我修改isPunctuation方法来识别这些特殊字母. 
会对算法有影响么. 如果单纯的加入EN_PUN_WORD词条貌似是不行.

Original comment by ase...@gmail.com on 6 Jul 2013 at 4:01

GoogleCodeExporter commented 9 years ago
恩, 修改isPunctuation方法不会影响算法的.  
你修改ENFILTER过滤器类即可. 
加上对希腊字母的识别应该很快的.

Original comment by chenxin6...@gmail.com on 6 Jul 2013 at 4:15

GoogleCodeExporter commented 9 years ago
下个版本会加上你说的功能, 感谢反馈.

Original comment by chenxin6...@gmail.com on 6 Jul 2013 at 2:12