public class StanfordAnnotator extends Object
The code has been moved away from the Parser component because it is also used by other components (e.g. Transformations)
Constructor and Description |
---|
StanfordAnnotator(TreeWithTokens aTokenTree) |
Modifier and Type | Method and Description |
---|---|
Constituent |
createConstituentAnnotation(int aBegin,
int aEnd,
String aConstituentType,
String aSyntacticFunction)
Creates a new Constituent annotation.
|
void |
createConstituentAnnotationFromTree(edu.stanford.nlp.trees.TreebankLanguagePack aTreebankLanguagePack,
boolean aCreatePos)
Creates linked constituent annotations, POS annotations and lemma-annotations.
|
Dependency |
createDependencyAnnotation(edu.stanford.nlp.trees.GrammaticalRelation aDependencyType,
Token aGovernor,
Token aDependent) |
static Dependency |
createDependencyAnnotation(org.apache.uima.jcas.JCas jCas,
edu.stanford.nlp.trees.GrammaticalRelation aDependencyType,
Token aGovernor,
Token aDependent)
Writes dependency annotations to the JCas
|
void |
createPennTreeAnnotation(int aBegin,
int aEnd)
Creates annotation with Penn Treebank style representations of the syntax tree
|
POS |
createPOSAnnotation(int aBegin,
int aEnd,
String aPosType)
Creates a new Constituent annotation.
|
void |
createTagAnnotation(int aBegin,
int aEnd,
String aTag)
Creates a tag-annotation over a constituent
|
org.apache.uima.jcas.JCas |
getJCas() |
TreeWithTokens |
getTokenTree() |
void |
recoverAnnotationsFromNodes()
Recovers annotations from a Stanford Tree-Object, which have been saved within the CoreLabel
of the tree.
|
void |
setConstituentMappingProvider(MappingProvider aConstituentMappingProvider) |
void |
setJCas(org.apache.uima.jcas.JCas aJCas) |
void |
setPosMappingProvider(MappingProvider aPosMappingProvider) |
void |
setTokenTree(TreeWithTokens aTokenTree) |
public StanfordAnnotator(TreeWithTokens aTokenTree) throws org.apache.uima.cas.CASException
org.apache.uima.cas.CASException
public TreeWithTokens getTokenTree()
public void setTokenTree(TreeWithTokens aTokenTree)
public org.apache.uima.jcas.JCas getJCas()
public void setJCas(org.apache.uima.jcas.JCas aJCas)
public void setPosMappingProvider(MappingProvider aPosMappingProvider)
public void setConstituentMappingProvider(MappingProvider aConstituentMappingProvider)
public void createConstituentAnnotationFromTree(edu.stanford.nlp.trees.TreebankLanguagePack aTreebankLanguagePack, boolean aCreatePos)
Note: The annotations are directly written to the indexes of the CAS.
aTreebankLanguagePack
- the language pack.aCreatePos
- whether to create POS annotations.public void createTagAnnotation(int aBegin, int aEnd, String aTag)
aBegin
- start-index of the constituent spanaEnd
- end-index of the constituent spanaTag
- the tag valuepublic Constituent createConstituentAnnotation(int aBegin, int aEnd, String aConstituentType, String aSyntacticFunction)
aBegin
- start-index of the constituent spanaEnd
- end-index of the constituent spanaConstituentType
- the constituent typeaSyntacticFunction
- the syntactic functionpublic POS createPOSAnnotation(int aBegin, int aEnd, String aPosType)
aBegin
- start-index of the constituent spanaEnd
- end-index of the constituent spanaPosType
- the constituent typepublic Dependency createDependencyAnnotation(edu.stanford.nlp.trees.GrammaticalRelation aDependencyType, Token aGovernor, Token aDependent)
public static Dependency createDependencyAnnotation(org.apache.uima.jcas.JCas jCas, edu.stanford.nlp.trees.GrammaticalRelation aDependencyType, Token aGovernor, Token aDependent)
jCas
- a CAS.aDependencyType
- the dependency typeaGovernor
- the governing-wordaDependent
- the dependent-wordpublic void createPennTreeAnnotation(int aBegin, int aEnd)
aBegin
- start offset.aEnd
- end offset.public void recoverAnnotationsFromNodes()
Note: Copying has to be done in batch, because we need to have ALL annotations that should be recovered together when copying them. The reason is that some annotations reference each other, which can cause problem if a referenced annotation has not yet been recovered.
Copyright © 2007–2018 Ubiquitous Knowledge Processing (UKP) Lab, Technische Universität Darmstadt. All rights reserved.