Exception when using the confidence metric
ali3assi opened this issue · 1 comments
ali3assi commented
Hi by adding:
nlp.add_pipe('dbpedia_spotlight', config={'process': 'candidates', 'confidence': 0.75})
the following exception is generated:
Traceback (most recent call last):
File "C:\Users\Admin\Documents\codePython\dbpedia\main.py", line 14, in <module>
doc = nlp(text)
File "C:\Users\Admin\miniconda3\envs\projet1\lib\site-packages\spacy\language.py", line 1022, in
__call__
error_handler(name, proc, [doc], e)
File "C:\Users\Admin\miniconda3\envs\projet1\lib\site-packages\spacy\util.py", line 1617, in raise_error
raise e
File "C:\Users\Admin\miniconda3\envs\projet1\lib\site-packages\spacy\language.py", line 1017, in
__call__
doc = proc(doc, **component_cfg.get(name, {})) # type: ignore[call-arg]
File "C:\Users\Admin\miniconda3\envs\projet1\lib\site-packages\spacy_dbpedia_spotlight\entity_linker.py", line 138, in __call__
start_ch = int(ent['@offset'])
TypeError: string indices must be integers
Any suggestion why I get such an exception please?
Thanks
MartinoMensio commented
Hi @ali3assi,
Thank you for reporting the issue.
It was a problem of the candidates
endpoint that:
- when a single candidate exists, it is inside a dict
- when multiple candidates exist, they are in a list
Version 0.2.2 of the package fixes it. Let me know if you have any problems.
Martino