You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug IndexError while visualizing results without entities extracted in the "rel" mode:
File ~/zshot/utils/displacy/relations_render.py:27, in parse_rels(doc)
25 tokens_span.append((filtered_spans[idx - 1].end, span.start, None))
26 tokens_span.append((span.start, span.end, span))
---> 27 if filtered_spans[-1].end < len(doc.text):
28 tokens_span.append((filtered_spans[-1].end, len(doc.text), None))
30 words = []
IndexError: list index out of range
To Reproduce
importspacyfromzshotimportPipelineConfig, displacyfromzshot.relation_extractorimportRelationsExtractorZSRCfromzshot.utils.data_modelsimportRelationnlp=spacy.load("en_core_web_sm")
nlp_config=PipelineConfig(
relations_extractor=RelationsExtractorZSRC(thr=0.1),
relations=[
Relation(name='located in', description="If something like a person, a building, or a company is located in a particular place, like a city, country of any other physical location, it is present or has been built there")
]
)
nlp.add_pipe("zshot", config=nlp_config, last=True)
text="IBM headquarters are located in Armonk."doc=nlp(text)
displacy.render(doc, style='rel')
Expected behavior
Show sentence without entities and relations
The text was updated successfully, but these errors were encountered:
Summary
Describe the bug
IndexError
while visualizing results without entities extracted in the "rel" mode:To Reproduce
Expected behavior
Show sentence without entities and relations
The text was updated successfully, but these errors were encountered: