HanLP调用方法 HanLP几乎所有的功能都可以通过工具类HanLP快捷调用,当你想不起来调用方法时,只需键入HanLP.,IDE应当会给出提示,并展示HanLP完善的文档。所有Demo都位于com.hankcs.demo下,比文档覆盖了更多细节,更新更及时,强烈建议运行一遍。
HanLP的适用过程中注意的问题: 1、因为HanLP版本更新比较频繁,所以,jar源代码版本需要对应适用,否则源码和jar中接口调用对应不上。
在进行CRF分词过程中报错: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:57) at java.nio.ByteBuffer.allocate(ByteBuffer.java:335) at com.hankcs.hanlp.corpus.io.IOUtil.readBytesFromFileInputStream(IOUtil.java:251) at com.hankcs.hanlp.corpus.io.IOUtil.readBytes(IOUtil.java:178) at com.hankcs.hanlp.corpus.io.ByteArray.createByteArray(ByteArray.java:47) at com.hankcs.hanlp.model.crf.CRFModel.loadTxt(CRFModel.java:89) at com.hankcs.hanlp.seg.CRF.CRFSegment.<init>(CRFSegment.java:58) at com.hankcs.hanlp.seg.CRF.CRFSegment.<init>(CRFSegment.java:73) at test.Main.main(Main.java:56)