Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding relations between Pronouns and Nouns in sentences

I am working on an NLP project and I need the following functionality illustrated by an example. Say there is a sentence

Tell Sam that he will have to leave without Arthur, as he is sick.

In this statement, the first he has to be tagged to Sam and the second he to Arthur. I work in Python. Any suggestions on what I can use to get the following functionality?

like image 848
Ameet Deshpande Avatar asked Dec 11 '22 11:12

Ameet Deshpande


2 Answers

This task is called coreference resolution. In order to parse complex cases like the one you mention, you'd need to use a coreference resolution system, most of which (free/OOS) are developed in Java. There are several ways to easily use them from Python. One of the most well-know is this Standford CoreNLP wrapper: https://github.com/dasmith/stanford-corenlp-python

like image 154
Josep Valls Avatar answered Dec 13 '22 00:12

Josep Valls


Update:

There are now Python native tools with coreference resolution, such as:

  • AllenNLP by AllenAI.

  • Huggingface which is almost a spaCy expansion.

  • StanfordNLP by Stanford.

These references were mainly retrieved from this nice RASA (a NLU based chatbot solution) tutorial: https://github.com/RasaHQ/tutorial-knowledge-base

like image 40
Tiago Duque Avatar answered Dec 13 '22 00:12

Tiago Duque