问题遇到的现象和发生背景
Hanlp环境差不多配置完了,最后也在hanlp.properties里配置了root
问题相关代码,请勿粘贴截图
import jpype
from jpype import *
jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.class.path=D:\Hanlp\hanlp-1.7.5.jar;D:\Hanlp\hannlp",
"-Xms1g",
"-Xmx1g") # 启动JVM,Linux需替换分号;为冒号:
print("=" * 30 + "HanLP分词" + "=" * 30)
HanLP = JClass('com.hankcs.hanlp.HanLP')
中文分词
print(HanLP.segment('小明硕士毕业于中国科学院计算所,后在日本京都大学深造。'))
print("-" * 70)
jpype.shutdownJVM()
运行结果及报错内容
TypeError: Class com.hankcs.hanlp.HanLP is not found