[英]Duckling, int() argument must be a string, a bytes-like object or a number, not 'java.lang.String',
I want to use duckling for time entity extraction from any string.我想使用小鸭从任何字符串中提取时间实体。
I am trying to use basic code for using duckling.我正在尝试使用基本代码来使用小鸭。
from duckling import DucklingWrapper
d = DucklingWrapper()
print(d.parse_time(u'Let\'s meet at 11:45am'))
For this I am getting following error.为此,我收到以下错误。 int() argument must be a string, a bytes-like object or a number, not 'java.lang.String'
int() 参数必须是字符串、类似字节的 object 或数字,而不是 'java.lang.String'
could anyone please help me with this?谁能帮我解决这个问题?
Short answer: force your jpype version to be below 0.8.简短回答:强制您的 jpype 版本低于 0.8。 ie pip install Jpype1==0.7.5
即pip安装Jpype1==0.7.5
Longer answer: This is due to one of Duckling's dependency JPype.更长的答案:这是由于 Duckling 的依赖之一 JPype。 If you dive into the code, you'll see that when starting the JVM using JPype, an argument "convertStrings" needs to be passed.
如果深入研究代码,您会发现在使用 JPype 启动 JVM 时,需要传递参数“convertStrings”。 Before V0.8 this argument was by default set to "true", but it was switch to "false" after that.
在 V0.8 之前,此参数默认设置为“true”,但之后切换为“false”。 This should be an easy fix within Duckling if you can modify the package code.
如果您可以修改 package 代码,这应该是 Duckling 中的一个简单修复。 If not, then downgrade your Jpype version will also work.
如果没有,那么降级你的 Jpype 版本也可以。
Ref: https://jpype.readthedocs.io/en/latest/api.html参考: https://jpype.readthedocs.io/en/latest/api.html
This is an incompatibility issue between duckling and Jpype.这是duckling和Jpype的不兼容问题。
This worked for me:这对我有用:
pip install --force-reinstall JPype1==0.6.3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.