automate relationships between entities


Is there a way to automate the linking between the different tagged labels without having to manually do the whole thing ?

thank you...

hi @flamit!

If you have an existing relations model, you can add relations to your stream so you are correcting the labels:

def add_relations_to_stream(stream):
   custom_model = load_your_custom_model()
   for eg in stream:
      deps, heads = custom_model(eg["text"])
      eg["relations"] = []
      for i, (label, head) in enumerate(zip(deps, heads)):
         eg["relations"].append({"child": i, "head": head, "label": label})
      yield eg

Or you can try DependencyMatcher as rules instead of the custom model:

I would recommend manually labeling a small part of the data, build a simple model, then add those relations to the stream, correcting the model and iterating. In this approach, you'll still need to manually annotate some examples, but many will include a model-in-the-loop to speed up the annotation time.

Hope this helps!