修改百度 LAC 分词的Java版本。 百度LAC 是很不错的分词工具。但是其java版本比较丑陋。 这里做了修改。 此外, baidu lac 受限于训练语料, 一些数字识别不正确,我们同时做了效果上的修改。
- 增加构造函数,从已有的LAC 对象复制一个对象。
- 增加close 函数,删除 jni 的 lac 对象
- 增加runLables 函数, 直接返回 crf 的标签
- 另外增加了一个Segmenter 对象,处理一些准业务
- 使用线程局部存储复制 LAC
- 返回对象修改为其他NLP 系统的格式
- 修正数字识别
- 长数字的硬性修改
- 一些数字应该是数量词
- 修正时间识别
- 时间识别的粒度变小一点
- 相同格式的不同时间识别结果保持一致(这个比较困难)
- clone 本项目
- 将native 目录下的压缩文件解开(就放到该目录下,不要有子目录)
- 另外安装baidu lac 的python版本 用data 目录下的文件增量训练
- 也可以不训练(也就不安装 百度lac), 直接使用本项目训练的模型
- 直接运行 项目中的两个类 的 main 方法
- 本项目编译的 native 代码 没有使用GPU, 如果要自己编译, 参照C++ 目录
- 打包jar
- 将 native 目录下的文件(解开后的)复制到目标机器的任意目录 java -Dlac_library_path=XXX 其中XXX 是存放上述native 文件的 目录。