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

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

Go to download

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

The newest version!
package edu.stanford.nlp.trees;

import edu.stanford.nlp.ling.Label;
import edu.stanford.nlp.util.Scored;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

/**
 * A Constituent object defines a generic edge in a graph.
 * The Constituent class is designed to be extended.  It
 * implements the Comparable interface in order to allow
 * graphs to be topologically sorted by the ordinary Collection
 * library in java.util, keying primarily on right-hand
 * node ID number.  The Constituent class implements most
 * of the functionality of the the Label
 * interface by passing all requests down to the Label which
 * might be contained in the Constituent.  This allows one
 * to put a Constituent anywhere that a Label is
 * required.  A Constituent is always Scored.
 *
 * @author Christopher Manning
 */
public abstract class Constituent implements Labeled, Scored, Label {

  public Constituent() {}

  /**
   * access start node.
   */
  public abstract int start();

  /**
   * set start node.
   */
  public abstract void setStart(int start);


  /**
   * access end node.
   */
  public abstract int end();


  /**
   * set end node.
   */
  public abstract void setEnd(int end);


  /**
   * access label
   */
  public Label label() {
    return null;
  }


  /**
   * Sets the label associated with the current Constituent,
   * if there is one.
   */
  public void setLabel(Label label) {
    // a noop
  }


  /**
   * Access labels -- actually always a singleton here.
   */
  public Collection




© 2015 - 2024 Weber Informatics LLC | Privacy Policy