ArrayIndexOutOfBoundsException
Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) Caused by: java.lang.ArrayIndexOutOfBoundsException: 65535 at com.hankcs.hanlp.collection.trie.bintrie.BinTrie.getChild(BinTrie.java:322) at com.hankcs.hanlp.collection.trie.bintrie.BaseNode.transition(BaseNode.java:56) at com.hankcs.hanlp.seg.Segment.combineByCustomDictionary(Segment.java:239) at com.hankcs.hanlp.seg.Viterbi.ViterbiSegment.segSentence(ViterbiSegment.java:55) at com.hankcs.hanlp.seg.Segment.seg(Segment.java:436) at com.hankcs.hanlp.tokenizer.StandardTokenizer.segment(StandardTokenizer.java:50) at com.hankcs.hanlp.HanLP.segment(HanLP.java:371)
? 请注明jar版本,触发代码。
感谢指正,这应该是文本中出现了'\uffff'这个字符所至,一般情况下正常文本中应该没有这么大的字符的。 这也是个不严密的bug,现在已经修复了: https://github.com/hankcs/HanLP/commit/78b18ee8b86811db4d2db8954dbd3b4b91a763f5
这个问题应该解决了,如果还有问题,欢迎再开issue。