Linking Labels

hi @Mohammad!

Thanks for your question.

Just to confirm, you trained an ner component for your entities ("CompaniesWorkedAt" ,"Designation" and "Location"), right?

And now you want to train a custom relations model to link those entities?

Step 1: Get relations annotations

You can now use the rel.manual recipe to annotate relations. Please read through our section in our docs.

Step 2: Training relations requires some configuration

As that section highlights:

Note that in order to train a model to predict relations between spans, you have to bring your own model implementation and implement your own training.

What's important to know is that unlike other native built-in spaCy components like ner, spancat, and textcat, there isn't a built-in spaCy component for relations. Therefore, prodigy train and data-to-spacy doesn't work out of the box for training relations.

However, we've created a tutorial video that explains how to build a custom trainable component with Thinc

including companion project with code too

What's important is that you can use most of Sofie's project for training. However, you will need to customize the code, especially the parse_data.py file. There's more details in these posts:

Since you also mentioned how to "link entities together", I suspect you may be interested in entity linking (aka entity disambiguation). Sofie also has a related video on entity linking as well:

And similar project too: