Skip to content
Advertisement

How to find named entity relationship

I was doing named entity relationship from the text of a book. I have done the Recognition using “spaCy” using its module “en_core_web_sm” as:

import en_core_web_sm
nlp = en_core_web_sm.load()
def NamedEntityRecognition(Text):
    doc = nlp(Text)
    list1 = []
    for ent in doc.ents:
        if ent.label_=='PERSON':
            list1.append((ent.text, ent.label_))
    return list1

I only wanted to find the PERSONS from it. Now I wish to find the relationship between different persons (How one person is related to another person, like “is a father of”, “is a brother of” kind of relationships) but I don’t have any idea about how to do it.

Advertisement

Answer

Probably you are referring to Relation Extraction.

What relationship between the entity “person” you seek to find out? Answering that question, and depending on your task you could customize your search.

In general, you should have a look here and here if you haven’t done that so far.

I hope those help with your problem.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement