简体   繁体   中英

Anaphora resolution example requested with 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM