运行书本74页代码时报下标越界

书本74页,运行书本配套代码 tests/book/ch02/demo_acdat_segment.py 报以下错误
Traceback (most recent call last):
File “/home/hilicop/workspace/pyhanlp-master/tests/book/ch02/demo_acdat_segment.py”, line 11, in
segment = JClass(‘com.hankcs.hanlp.seg.Other.AhoCorasickDoubleArrayTrieSegment’)()
File “/home/hilicop/anaconda3/envs/learnhanlp/lib/python3.7/site-packages/jpype/_jobject.py”, line 95, in init
jv = self.class.javaclass.newInstance(*args)
jpype._jclass.IndexOutOfBoundsException: Index: 0, Size: 0

无法复现,看上去像是加载了0个词条。检查自己的数据。

HanLP默认加载pyhanlp/static/data/dictionary/CoreNatureDictionary.txt,如果你自己写了配置文件那就可能是另一个文件,你的系统上可能这个文件出问题了,比如是一个空白文件。你也可以运行一下其他代码看看有没有出错。总之,开源这么多年,我从未收到类似报告。

好的,现在在一一排查

问题解决了,好像是我的java版本太低,用的是java8,换成java11问题就没了。