简体   繁体   中英

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'

could anyone please help me with this?

Short answer: force your jpype version to be below 0.8. ie pip install Jpype1==0.7.5

Longer answer: This is due to one of Duckling's dependency JPype. If you dive into the code, you'll see that when starting the JVM using JPype, an argument "convertStrings" needs to be passed. Before V0.8 this argument was by default set to "true", but it was switch to "false" after that. This should be an easy fix within Duckling if you can modify the package code. If not, then downgrade your Jpype version will also work.

Ref: https://jpype.readthedocs.io/en/latest/api.html

This is an incompatibility issue between duckling and Jpype.

This worked for me:

pip install --force-reinstall JPype1==0.6.3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM