How to implement a good Pronoun Resolver algorithm in OpenNLP?
I use OpenNLP's coreference package for anaphora resolution. So basically I have this input string:
"Harry writes a letter to his brother. He told him that he met Mary in London. They had a lunch together.";
The set of mentions output are as below:
Harry, his, He, him, he, They
I need to replace the pronouns with its proper nouns. I wrote a simple algorithm for this by adding each mention into a list, then iterate the list while replacing each pronouns with the 1st mention ("Harry"). My problem is "his" will be "Harry" not "Harry's".
There aren't a lot of examples/tutorials on pronoun resolver. I have looked through the OpenNLP API. Either I'm looking in the wrong direction or there is one in the API but I don't know how to use it. Can someone please guide me in the right direction to pronoun resolving or give an example of how to do this? Maybe there's a better way that I didn't know of.
What you want is called "co-reference resolution".
Linker _linker = null;
try {
_linker = new DefaultLinker("lib/opennlp/coref", LinkerMode.TEST);
} catch (final IOException ioe) {
ioe.printStackTrace();
}
Here's a perfect tutorial with code examples:
http://blog.dpdearing.com/2012/11/making-coreference-resolution-with-opennlp-1-5-0-your-bitch/
Stanford CoreNLP also provides a good model for it.
http://nlp.stanford.edu/software/dcoref.shtml
链接地址: http://www.djcxy.com/p/73474.html