Skip to content
Discussion options

You must be logged in to vote

Hey AdirthaBorgohain,

I think what you are suggesting makes sense. The tutorial implementation is currently not flexible enough to work on any doc.spans, but requires doc.ents to be set: https://github.com/explosion/projects/blob/v3/tutorials/rel_component/scripts/rel_pipe.py#L23. As you mention doc.ents has to be non-overlapping.

So for example the:

import spacy

nlp = spacy.load("en_core_web_lg")
doc = nlp("We visited The Bob's Burgers Museum")
print(doc.ents)

This prints (The Bob's Burgers Museum,). We can add more entities like:

from spacy.tokens import Span

doc.ents += (Span(doc, 0, 1, "test"), )
print(doc.ents)

Now we have (We, The Bob's Burgers Museum). But when we try to add "Bob…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by svlandeg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat / rel Feature: Relation Extractor
2 participants