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

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

Go to download

Stanford CoreNLP provides a set of natural language analysis tools which can take raw English language text input and give the base forms of words, their parts of speech, whether they are names of companies, people, etc., normalize dates, times, and numeric quantities, mark up the structure of sentences in terms of phrases and word dependencies, and indicate which noun phrases refer to the same entities. It provides the foundational building blocks for higher level text understanding applications.

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

import edu.stanford.nlp.ling.CoreAnnotation;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.util.ErasureUtils;
import edu.stanford.nlp.util.ScoredObject;

import java.util.List;

/**
 * Set of common annotations for {@link edu.stanford.nlp.util.CoreMap}s 
 * that require classes from the trees package.  See 
 * {@link edu.stanford.nlp.ling.CoreAnnotations} for more information.
 * This class exists so that
 * {@link edu.stanford.nlp.ling.CoreAnnotations} need not depend on
 * trees classes, making distributions easier.
 * @author Anna Rafferty
 *
 */

public class TreeCoreAnnotations {
  
  private TreeCoreAnnotations() {} // only static members

  /**
   * The CoreMap key for getting the syntactic parse tree of a sentence.
   *
   * This key is typically set on sentence annotations.
   */
  public static class TreeAnnotation implements CoreAnnotation {
    public Class getType() {
      return Tree.class;
    }
  }

  /**
   * The CoreMap key for getting the binarized version of the
   * syntactic parse tree of a sentence.
   *
   * This key is typically set on sentence annotations.  It is only
   * set if the parser annotator was specifically set to parse with
   * this (parse.saveBinarized).  The sentiment annotator requires
   * this kind of tree, but otherwise it is not typically used.
   */
  public static class BinarizedTreeAnnotation implements CoreAnnotation {
    public Class getType() {
      return Tree.class;
    }
  }

  /**
   * The standard key for storing a head word in the map as a pointer to
   * the head label.
   */
  public static class HeadWordLabelAnnotation implements CoreAnnotation {
    public Class getType() {  return CoreLabel.class; } }

  /**
   * The standard key for storing a head tag in the map as a pointer to
   * the head label.
   */
  public static class HeadTagLabelAnnotation implements CoreAnnotation {
    public Class getType() {  return CoreLabel.class; } }

  /**
   * The standard key for storing a list of k-best parses.
   */
  public static class KBestTreesAnnotation implements CoreAnnotation> {
    public Class> getType() {
      return ErasureUtils.uncheckedCast(List.class);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy