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.
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
textcat, there isn't a built-in spaCy component for
prodigy train and
data-to-spacy doesn't work out of the box for training
However, we've created a tutorial video that explains how to build a custom trainable component with
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: