Example usage for edu.stanford.nlp.trees Tree headTerminal

List of usage examples for edu.stanford.nlp.trees Tree headTerminal

Introduction

In this page you can find the example usage for edu.stanford.nlp.trees Tree headTerminal.

Prototype

public Tree headTerminal(HeadFinder hf) 

Source Link

Document

Returns the tree leaf that is the head of the tree.

Usage

From source file:knu.univ.lingvo.coref.MentionExtractor.java

License:Open Source License

private void addFoundPair(Tree np1, Tree np2, Tree t, Set<Pair<Integer, Integer>> foundPairs) {
    Tree head1 = np1.headTerminal(headFinder);
    Tree head2 = np2.headTerminal(headFinder);
    int h1 = ((CoreMap) head1.label()).get(CoreAnnotations.IndexAnnotation.class) - 1;
    int h2 = ((CoreMap) head2.label()).get(CoreAnnotations.IndexAnnotation.class) - 1;
    Pair<Integer, Integer> p = new Pair<Integer, Integer>(h1, h2);
    foundPairs.add(p);//  w  w  w . j  ava  2s .c  om
}