Linking Labels

After I trained the model to extract "CompaniesWorkedAt" ,"Designation" and "Location" the model predict labels that not linking to each other . How I can add relation between the entities or link entities to together.

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 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: