Named Entity Relations - beginner questions

Hi! The relations workflow in Prodigy is still very new and it's important to note that spaCy currently doesn't have a built-in out-of-the-box model implementation for predicting relations between entities – so you'd have to bring your own. Some related threads:

Yes, the parser is designed specifically for dependency parsing, so using it in this way wouldn't really work. The task of dependency parsing and the assumptions a parser makes are quite different from what you're going for.

There's no definitive answer for that and it will depend on the model you're using and what exactly you want to predict.

Since the relation prediction task would happen in a separate step, I think it's fine to just focus on the entities you're interested in and only run your relation extraction logic if an entity type PERSON is found, etc.

The built-in dep visualizer can visualize Doc objects using their token.head and token.dep_ values. So if those are set (which you can also do manually), you'll be able to visualize it. If you want to visualize relations between spans like entities, one easy option would be to merge them into one token (using Doc.retokenize) beforehand.

(If you tried to render a visualization and all tokens were attached to themselves, this usually indicates that the heads weren't set and the default values were used.)

1 Like