Skip to content
Discussion options

You must be logged in to vote

Hello ✨,
you can save the spans inside doc.spans instead of doc.ents , giving you the possibility to have overlapping spans. (https://spacy.io/api/doc#spans)

For your usecase it could look like this:

doc.spans["Match"] = original_ents

doc.spans is a dictionary of SpanGroups which is a container for Span objects, instead of the key "Match", used in the example above, you can choose whatever key you seem fit. 😄 Since your use case works with a rule based approach, there is no need to implement the SpanCategorizer pipeline inside your function

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by thomashacker
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage General spaCy usage feat / doc Feature: Doc, Span and Token objects
3 participants