edu.stanford.nlp.ling.StringLabelFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stanford-corenlp Show documentation
Show all versions of stanford-corenlp Show documentation
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.
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);
}
}