pyhanlp在Debug断掉调试模型就会Python停止工作
注意事项
请确认下列注意事项:
- 我已仔细阅读下列文档,都没有找到答案:
- 我已经通过Google和issue区检索功能搜索了我的问题,也没有找到答案。
- 我明白开源社区是出于兴趣爱好聚集起来的自由社区,不承担任何责任或义务。我会礼貌发言,向每一个帮助我的人表示感谢。
- [x] 我在此括号内输入x打钩,代表上述事项确认完毕。
版本号
当前最新版本号是:1.6.8 我使用的版本是:1.6.8
我的问题
在使用pyhanlp过程中,如果是Debug模式,使用IDEA断点调试,就会出现Python停止工作

感谢反馈,确认此问题存在。 由于JPype限制,目前无法在调用Java对象时下断点,但不影响其他场景下的断点。你可以简单包装一下:
from pyhanlp import *
def segment(text):
return [(str(t.word), str(t.nature)) for t in HanLP.segment(text)]
for term in segment('商品和服务'):
print(term)
发现在springboot项目中使用debug as junit时无法运行 @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class HanlpArtAnalysisTest { @Test public void Test() { String str="不及f-22灵活"; // Segment seg=HanLP.newSegment(); System.out.println(NLPTokenizer.segment(str)); System.out.println(HanLP.segment(str)); System.out.println(StandardTokenizer.segment(str));
}
}
把@@SpringBootTest去掉,不要用SpringBoot测试,用普通就行了
