All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.stanford.nlp.trees.LeftHeadFinder Maven / Gradle / Ivy

Go to download

Stanford Parser processes raw text in English, Chinese, German, Arabic, and French, and extracts constituency parse trees.

There is a newer version: 3.9.2
Show newest version
package edu.stanford.nlp.trees;


/**
 * HeadFinder that always returns the leftmost daughter as head.  For
 * testing purposes.
 *
 * @author Roger Levy
 */
public class LeftHeadFinder implements HeadFinder {

  /**
   * 
   */
  private static final long serialVersionUID = 8453889846239508208L;

  public Tree determineHead(Tree t) {
    if (t.isLeaf()) {
      return null;
    } else {
      return t.children()[0];
    }
  }

  public Tree determineHead(Tree t, Tree parent) {
    return determineHead(t);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy