informagi / REL

REL: Radboud Entity Linker
https://rel.readthedocs.io/
MIT License
304 stars 68 forks source link

Error when querying API with specific sentence #134

Closed flackbash closed 1 year ago

flackbash commented 1 year ago

Hi,

When I run the EL example code from the README, but replace the example text with the sentence "Kennedy was also an active politician, yet he is most known for his writings, some of which he published under the name of Mark Littleton." (a sentence from the KORE50 dataset), I get the error

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/requests/models.py", line 960, in json
    return complexjson.loads(self.content.decode(encoding), **kwargs)
  File "/usr/lib64/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.10/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib64/python3.10/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/natalie/rel_test.py", line 10, in <module>
    }).json()
  File "/usr/lib/python3.10/site-packages/requests/models.py", line 968, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This is the exact code for reproducibility:

import requests

API_URL = "https://rel.cs.ru.nl/api"
text_doc = "Kennedy was also an active politician, yet he is most known for his writings, some of which he published under the name of Mark Littleton."

# Example EL.
el_result = requests.post(API_URL, json={
    "text": text_doc,
    "spans": []
}).json()
print(el_result)

The original example text works fine as well as several other sentences from KORE50. Unless I set up and use my own REL server instead of the API, but that's something for a separate issue.

Do you have any idea what might cause this and how to fix it?

abhinavkulkarni commented 1 year ago

Hey @flackbash,

I think they limit use of API to the specific sentence in the README. I had to download all the necessary files on my computer in order to use it with other sentences.

flackbash commented 1 year ago

Hey @abhinavkulkarni , thanks for your reply! I did manage to link several other sentences with their API, but this one always failed so my guess would be some bug in the API code that's currently run. I just set the system up locally by building my own docker image from the code base (pulling the prebuilt docker image yielded an error, too) and it looks like this is working :)

hasibi commented 1 year ago

Hi @flackbash and @abhinavkulkarni,

Thanks for raising the issue. The issue is raised because the sentence contains "Mark Littleton." This should be a bug. We will investigate it.

KDercksen commented 1 year ago

Hi all,

This should now be fixed in the public API. We removed some rogue code that wasn't supposed to be there :pirate_flag: :skull_and_crossbones:

I'll close this now, but feel free to reopen if you run into the same issue again!

flackbash commented 1 year ago

Great, thank you!