Akash Yadav
Akash Yadav

Reputation: 1

Duckling inconsistent result

I am using Duckling for one of my projects to extract dates from given sentences. Initially, I pass the sentence to spaCy, which returns the substring falling under the DATE entity (for example, 'last week'). Then, I pass this substring ('last week') to Duckling, which provides the respective result.

Everything was working fine until I started encountering this error:

I am sending three subsequent requests to Duckling(through django api)[doing load api testing by creating collection with the above 3 request and running for 5 virtual users].

any advise will do good!!

/*Internal Server Error: /nlusrch/tokens/
Traceback (most recent call last):
File "django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "django/views/decorators/csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
File "django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
File "rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "rest_framework/decorators.py", line 50, in handler
return func(*args, **kwargs)
File "nluTextExtraction/views.py", line 64, in tokenextraction
File "nluTextExtraction/views.py", line 338, in dateExtraction
File "duckling/duckling.py", line 160, in parse
return self._parse_result(duckling_result)
File "duckling/duckling.py", line 185, in _parse_result
entry[key] = self._parse_dict(
File "duckling/duckling.py", line 220, in _parse_dict
result[key] = _functions_with_dim[key](field.getValue(), dim)
File "duckling/duckling.py", line 220, in _parse_dict
result[key] = _functions_with_dim[key](field.getValue(), dim)
File "duckling/duckling.py", line 260, in _parse_value
return _dimsdim
File "duckling/duckling.py", line 232, in _parse_float
return float(java_number.toString())
RuntimeError: Ambiguous overloads found: (I) vs (Ljava/lang/Integer;) at native/common/jp_method.cpp:117
[21/Mar/2024 14:10:24] "POST /nlusrch/tokens/ HTTP/1.1" 500 128079
import duckling
import spacy

parser= duckling.Duckling()
parser.load()

nlp = spacy.load("en_core_web_lg")

doc = nlp("give me last week information")

temporal_entities = [ent.text for ent in doc.ents if ent.label_ == 'DATE']

if temporal_entities:
     response = parser.parse(temporal_entities[0]) //at this line i am getting the error

Upvotes: 0

Views: 31

Answers (0)

Related Questions