QuickUMLS icon indicating copy to clipboard operation
QuickUMLS copied to clipboard

[BUG]ValueError: [E090] Extension 'similarity' already exists on Span. To overwrite the existing extension, set `force=True` on `Span.set_extension`.

Open nitzanbar29 opened this issue 1 year ago • 4 comments

Describe the bug Hi, I use the example in the demo.

I'm facing this error:

ValueError: [E090] Extension 'similarity' already exists on Span. To overwrite the existing extension, set force=True on Span.set_extension.

To Reproduce

common English pipeline

nlp = spacy.load('en_core_web_sm')

@Language.component('quickumls_component') def quickumls_component(doc): return SpacyQuickUMLS(nlp, umls_path1)(doc)

quickumls_component = SpacyQuickUMLS(nlp, umls_path1) nlp.add_pipe('quickumls_component', last=True)

doc = nlp('Pt c/o shortness of breath, chest pain, nausea, vomiting, diarrrhea')

for ent in doc.ents: print('Entity text : {}'.format(ent.text)) print('Label (UMLS CUI) : {}'.format(ent.label_)) print('Similarity : {}'.format(ent..similarity)) print('Semtypes : {}'.format(ent..semtypes))

**Environment **

  • OS: Unbuntu
  • QuickUMLS version 1.4.0
  • UMLS version 2023

Thanks :)

nitzanbar29 avatar Jan 03 '24 08:01 nitzanbar29

I am facing the same issue.

rmalla1 avatar Mar 31 '24 05:03 rmalla1

Got the same error code here.

JuneHou avatar May 20 '24 17:05 JuneHou

Same issue

msegar avatar Aug 03 '24 19:08 msegar

You define multiple SpacyQuickUMLS instances in your code:

@Language.component('quickumls_component')
def quickumls_component(doc):
quickumls_component = SpacyQuickUMLS(nlp, umls_path1)

The Span.set_extension method is called repeatedly during each instantiation, and Spacy does not allow repeated definition of the same extension attributes (like similarity and semtypes), so delete quickumls_component.

RuiqiTu avatar Dec 24 '24 07:12 RuiqiTu