调用crf分词的时候出现ArrayIndexOutOfBoundsException错误
错误如下:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 148
at com.hankcs.hanlp.seg.common.Vertex.compileRealWord(Vertex.java:115)
at com.hankcs.hanlp.seg.common.Vertex.
找到是下面这句出错
String str = "什么是谷精草";
List
谷精草这个东西我通过自定义词典定义为其他的词语,此处不知道出现了什么错误,希望能够得到解答,谢谢
我无法复现你的问题,有可能是反射词性引发的,警告已经说了现在的策略了。额外附赠一点建议,试试升级JDK1.8或其他高一点版本的JDK,现在的反射代码在1.8上面运行良好。
public void testIssue452() throws Exception
{
CustomDictionary.insert("谷精草", "其他 123");
System.out.println(new CRFSegment().enableCustomDictionary(true).seg("什么是谷精草"));
}
Mar 30, 2017 6:42:37 PM com.hankcs.hanlp.corpus.util.CustomNatureUtility
先谢谢你的回答。我的jdk已经是1.8的。然后目前已经解决了这个问题,我在源代码的某些地方加上了我新增的词性。出现这个错误大概是由于 某些词 本身的词性为 null。进入自定义词性遍历的步骤时,没办法匹配词性,故而导致上述问题。 不管怎么样,还是很感谢你的回答。