Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anaphora resolution example requested with python-nltk

Tags:

python

nltk

I have been looking into the howto for nltk-drt and into the module definitions for nltk.sem.drt but I am having a really hard time trying to understand how to achieve basic functionality using these packages.

An example of a task that I would like to achieve is the following: Given the sentence

Google is one of the largest tech companies. It employees many people.

I would like to be able to write a small function that parses a sentence such as this, and return a sentence such as

Google is one of the largest tech companies. Google employees many people.

A more realistic test case can be something like

Tom, Dick and Harry were invited to her party, but declined. This made Sherry angry.

being resolved to

Tom, Dick and Harry were invited to Sherry party, but declined. This made Sherry angry.

like image 267
CCG Avatar asked Dec 20 '22 14:12

CCG


1 Answers

I don't think DRT (Discourse Representation Theory) deals with anaphora resolution, like what you wanted. It deals with representing the meaning of a sentence in formal logic.

Also, there is a name for your "more realistic test case", which is called "cataphora".

Anaphora resolution is difficult, but you can try Stanford DCoref

And see some examples here: Anaphora resolution using Stanford Coref

like image 117
justhalf Avatar answered Dec 29 '22 18:12

justhalf