Skip to content
Discussion options

You must be logged in to vote

It's true Spans are ephemeral, but they're tied to the Doc they come from, so I don't think putting a Span under its parent Doc should be a problem. That's the strategy used in the relation extraction component, which uses a doc._.rel extension, so for the relation A eats B you would have something like:

A = doc[...] # these are entity spans you got somehow
B = doc[...] 
doc._.rel = {(A, B): {"eats": 1.0}}

You can also use doc.spans for this purpose. The Spans in a SpanGroup are ordered so you can convey a relationship that way, though I think the extension might be clearer.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kinghuang
Comment options

Answer selected by kinghuang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat / doc Feature: Doc, Span and Token objects
2 participants