How to train and correct a Named Entity Recognition with relation extraction

I can not find how to train an entity and relation annotation done at the same time.

And how to correct one time done?

I mean if I do

prodigy rel.manual ner_rels blank:en ./data.jsonl --label SUBJECT,LOCATION --span-label PERSON,GPE --wrap --add-ents

and then I use

prodigy train parser ner_rels en_core_web_lg --output ./model

The nerd and relation model are trained at the same time? ANd how I correct the results like ner.correct but with relations too?

thx

Hi! The prodigy train command lets you train a single component, specified via the first argument. Training parser will train a dependency parser, and spaCy will expect dependency parsing annotations. spaCy doesn't currently have a built-in component for entity relation extraction, so you'd have to bring your own implementation for that. See this thread for details:

You can always load pre-annotated data into Prodigy by providing input data in the same format. See here for what the relations interface expects: https://prodi.gy/docs/api-interfaces#relations

So if you have a model or some other process that outputs relations, you can run it over the incoming texts, add a "relations" key with the predictions and then correct them manually in the UI. Here's an example for how this works for NER: https://prodi.gy/docs/named-entity-recognition#custom-model The same works for relations – you'd just be adding a key "relations" instead :slightly_smiling_face:

1 Like