|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.pipeline.AnnotationPipeline
edu.stanford.nlp.pipeline.StanfordCoreNLP
public class StanfordCoreNLP
This is a pipeline that takes in a string and returns various analyzed linguistic forms. The String is tokenized via a tokenizer (such as PTBTokenizerAnnotator), and then other sequence model style annotation can be used to add things like lemmas, POS tags, and named entities. These are returned as a list of CoreLabels. Other analysis components build and store parse trees, dependency graphs, etc.
This class is designed to apply multiple Annotators to an Annotation. The idea is that you first build up the pipeline by adding Annotators, and then you take the objects you wish to annotate and pass them in and get in return a fully annotated object. Please see the package level javadoc for sample usage and a more complete description.
The main entry point for the API is StanfordCoreNLP.process()
Implementation note: There are other annotation pipelines, but they don't extend this one. Look for classes that implement Annotator and which have "Pipeline" in their name.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface edu.stanford.nlp.pipeline.Annotator |
|---|
Annotator.Requirement |
| Field Summary | |
|---|---|
static java.lang.String |
CUSTOM_ANNOTATOR_PREFIX
|
static java.lang.String |
DEFAULT_OUTPUT_FORMAT
|
static java.lang.String |
NEWLINE_SPLITTER_PROPERTY
|
| Fields inherited from class edu.stanford.nlp.pipeline.AnnotationPipeline |
|---|
TIME |
| Constructor Summary | |
|---|---|
StanfordCoreNLP()
Constructs a pipeline using as properties the properties file found in the classpath |
|
StanfordCoreNLP(java.util.Properties props)
Construct a basic pipeline. |
|
StanfordCoreNLP(java.util.Properties props,
boolean enforceRequirements)
|
|
StanfordCoreNLP(java.lang.String propsFileNamePrefix)
Constructs a pipeline with the properties read from this file, which must be found in the classpath |
|
StanfordCoreNLP(java.lang.String propsFileNamePrefix,
boolean enforceRequirements)
|
|
| Method Summary | |
|---|---|
void |
annotate(Annotation annotation)
Run the pipeline on an input annotation. |
static void |
clearAnnotatorPool()
Call this if you are no longer using StanfordCoreNLP and want to release the memory associated with the annotators. |
double |
getBeamPrintingOption()
|
TreePrint |
getConstituentTreePrinter()
|
TreePrint |
getDependencyTreePrinter()
|
java.lang.String |
getEncoding()
|
static Annotator |
getExistingAnnotator(java.lang.String name)
|
java.util.Properties |
getProperties()
Fetches the Properties object used to construct this Annotator |
static boolean |
isXMLOutputPresent()
|
static void |
main(java.lang.String[] args)
This can be used just for testing or for command-line text processing. |
void |
prettyPrint(Annotation annotation,
java.io.OutputStream os)
Displays the output of all annotators in a format easily readable by people. |
void |
prettyPrint(Annotation annotation,
java.io.PrintWriter os)
Displays the output of all annotators in a format easily readable by people. |
Annotation |
process(java.lang.String text)
Runs the entire pipeline on the content of the given text passed in. |
void |
processFiles(java.util.Collection<java.io.File> files)
|
void |
processFiles(java.util.Collection<java.io.File> files,
int numThreads)
|
java.lang.String |
timingInformation()
Return a String that gives detailed human-readable information about how much time was spent by each annotator and by the entire annotation pipeline. |
void |
xmlPrint(Annotation annotation,
java.io.OutputStream os)
Displays the output of all annotators in XML format. |
void |
xmlPrint(Annotation annotation,
java.io.Writer w)
Wrapper around xmlPrint(Annotation, OutputStream). |
| Methods inherited from class edu.stanford.nlp.pipeline.AnnotationPipeline |
|---|
addAnnotator, annotate, annotate, annotate, annotate, getTotalTime, requirementsSatisfied, requires |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CUSTOM_ANNOTATOR_PREFIX
public static final java.lang.String NEWLINE_SPLITTER_PROPERTY
public static final java.lang.String DEFAULT_OUTPUT_FORMAT
| Constructor Detail |
|---|
public StanfordCoreNLP()
public StanfordCoreNLP(java.util.Properties props)
public StanfordCoreNLP(java.util.Properties props,
boolean enforceRequirements)
public StanfordCoreNLP(java.lang.String propsFileNamePrefix)
propsFileNamePrefix -
public StanfordCoreNLP(java.lang.String propsFileNamePrefix,
boolean enforceRequirements)
| Method Detail |
|---|
public java.util.Properties getProperties()
public TreePrint getConstituentTreePrinter()
public TreePrint getDependencyTreePrinter()
public double getBeamPrintingOption()
public java.lang.String getEncoding()
public static boolean isXMLOutputPresent()
public static void clearAnnotatorPool()
public static Annotator getExistingAnnotator(java.lang.String name)
public void annotate(Annotation annotation)
AnnotationPipeline
annotate in interface Annotatorannotate in class AnnotationPipelineannotation - The input annotation, usually a raw documentpublic Annotation process(java.lang.String text)
text - The text to process
public void prettyPrint(Annotation annotation,
java.io.OutputStream os)
annotation - Contains the output of all annotatorsos - The output stream
public void prettyPrint(Annotation annotation,
java.io.PrintWriter os)
annotation - Contains the output of all annotatorsos - The output stream
public void xmlPrint(Annotation annotation,
java.io.Writer w)
throws java.io.IOException
annotation - w - The Writer to send the output to
java.io.IOException
public void xmlPrint(Annotation annotation,
java.io.OutputStream os)
throws java.io.IOException
annotation - Contains the output of all annotatorsos - The output stream
java.io.IOExceptionpublic java.lang.String timingInformation()
println().
timingInformation in class AnnotationPipeline
public void processFiles(java.util.Collection<java.io.File> files,
int numThreads)
throws java.io.IOException
java.io.IOException
public void processFiles(java.util.Collection<java.io.File> files)
throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)
throws java.io.IOException,
java.lang.ClassNotFoundException
Example usage:
java -mx6g edu.stanford.nlp.pipeline.StanfordCoreNLP properties
args - List of required properties
java.io.IOException - If IO problem
java.lang.ClassNotFoundException - If class loading problem
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||