omkar
omkar

Reputation: 31

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?

Upvotes: 2

Views: 692

Answers (2)

Uri
Uri

Reputation: 26986

This is an incompatibility issue between duckling and Jpype.

This worked for me:

pip install --force-reinstall JPype1==0.6.3

Upvotes: 1

Wang Wei Kung
Wang Wei Kung

Reputation: 1

Short answer: force your jpype version to be below 0.8. i.e. 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

Upvotes: 0

Related Questions