Imdict的官方网址
http://code.google.com/p/imdict-chinese-analyzer/
做项目开始,我才发现读源码是一件很能提升自己编码水平的一件事情
在别人的源码里,你会发现好多编码思想,还有一些很实用的方法,他们都写出来了
在巨人的肩膀上 这话说的真不错
该分词器不能添加自己定义的词库,如果你懂java(读了源码你自己也可以加进去)
网上有个人早对他做了修改
http://insolr.com/forum.php?mod=viewthread&tid=1057&extra=page%3D1
在这里我曾经发过
添加自己词库我就不介绍了,onedear 介绍的很清楚了
我只在这里写写他字典的生成原理代码入下:
private void getMydict() {
wordDict = WordDictionary.getInstance();
char[][][] wordItem_charArrayTable = wordDict
.getWordItem_charArrayTable();
int[][] wordItem_frequencyTable= wordDict.getWordItem_frequencyTable();
short[] wordIndexTable =wordDict.getWordIndexTable();
char[] charIndexTable =wordDict.getCharIndexTable();
try {
FileOutputStream fos = new FileOutputStream("ciku.txt"); //这里就是你的词库
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(wordIndexTable);
oos.writeObject(charIndexTable);
oos.writeObject(wordItem_charArrayTable);
oos.writeObject(wordItem_frequencyTable);
oos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
这样你就得到和他格式一样的一个名为ciku.txt 的文件了,他和他自己带的.men 格式就是同一类型了,你用你的ciku.txt 替换他的.men 就可以了
