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

edu.stanford.nlp.ling.StringLabelFactory 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.ling;


/**
 * A StringLabelFactory object makes a simple
 * StringLabel out of a String.
 *
 * @author Christopher Manning
 */
public class StringLabelFactory implements LabelFactory {

  /**
   * Make a new label with this String as the "name".
   *
   * @param labelStr A string that determines the content of the label.
   *                 For a StringLabel, it is exactly the given string
   * @return The created label
   */
  public Label newLabel(String labelStr) {
    return new StringLabel(labelStr);
  }


  /**
   * Make a new label with this String as the "name".
   *
   * @param labelStr A string that determines the content of the label.
   *                 For a StringLabel, it is exactly the given string
   * @param options  The options are ignored by a StringLabelFactory
   * @return The created label
   */
  public Label newLabel(String labelStr, int options) {
    return new StringLabel(labelStr);
  }


  /**
   * Make a new label with this String as the "name".
   * This version does no decoding -- StringLabels just have a value.
   *
   * @param labelStr A string that determines the content of the label.
   *                 For a StringLabel, it is exactly the given string
   * @return The created label
   */
  public Label newLabelFromString(String labelStr) {
    return new StringLabel(labelStr);
  }


  /**
   * Create a new StringLabel, where the label is
   * formed from
   * the Label object passed in.  Depending on what fields
   * each label has, other things will be null.
   *
   * @param oldLabel The Label that the new label is being created from
   * @return a new label of a particular type
   */
  public Label newLabel(Label oldLabel) {
    return new StringLabel(oldLabel);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy