-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Error in merge_phrases #975
Copy link
Copy link
Closed
Labels
usageGeneral spaCy usageGeneral spaCy usage
Description
Got such error
"Error calculating span: Can't find start"
When i tried to put such text
"What factors is iShares 1-3 Year Credit Bond exposed with"
code of merge_phrases
def merge_phrases(matcher, doc, i, matches):
'''
Merge a phrase. We have to be careful here because we'll change the token indices.
To avoid problems, merge all the phrases once we're called on the last match.
'''
if i != len(matches)-1:
return None
spans = [(ent_id, label, doc[start : end]) for ent_id, label, start, end in matches]
for ent_id, label, span in spans:
span.merge('NNP' if label else span.root.tag_, span.text, settings.nlp.vocab.strings[label])
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
usageGeneral spaCy usageGeneral spaCy usage