Book Image

Natural Language Processing with Java and LingPipe Cookbook

Book Image

Natural Language Processing with Java and LingPipe Cookbook

Overview of this book

Table of Contents (14 chapters)
Natural Language Processing with Java and LingPipe Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Adding pronouns to coreference


The preceding recipe handled coreference between named entities. This recipe will add pronouns to the mix.

How to do it…

This recipe will use an interactive version to help you explore the properties of the coreference algorithm. The system is very dependent on the quality of the named-entity detection, so use examples that the HMM is likely to get right. This was trained on Wall Street Journal articles from the '90s.

  1. Saddle up your console and type the following command:

    java -cp lingpipe-cookbook.1.0.jar:lib/lingpipe-4.1.0.jar: com.lingpipe.cookbook.chapter7.Coreference
    
  2. In the resulting command prompt, type this:

    Enter text followed by new line
    >John Smith went to Washington. He was a senator.
    Sentence Text=John Smith went to Washington.
    mention text=John Smith type=PERSON id=0
    mention text=Washington type=LOCATION id=1
    Sentence Text= He was a senator.
    mention text=He type=MALE_PRONOUN id=0
  3. The shared ID between He and John Smith indicates the coreference between...