public abstract class TregexPoweredTreebankParserParams extends AbstractTreebankParserParams
AbstractTreebankParserParams
which provides support for Tregex-powered annotations.
Subclasses of this class provide collections of features
which are associated with annotation behaviors that seek out
and label matching trees in some way. For example, a coord
feature might have an annotation behavior which searches for
coordinating noun phrases and labels the associated constituent
with a suffix -coordinating.
The "search" in this process is conducted via Tregex, and the
actual annotation is done through execution of an arbitrary
Function provided by the user.
This class carries as inner several classes several useful common
annotation functions.annotations,
TregexPoweredTreebankParserParams.SimpleStringFunction,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
protected static class |
TregexPoweredTreebankParserParams.AnnotateHeadFunction
Annotate a tree constituent with its lexical head.
|
protected static class |
TregexPoweredTreebankParserParams.SimpleStringFunction
Annotates all nodes that match the tregex query with some string.
|
AbstractTreebankParserParams.AnnotatePunctuationFunction, AbstractTreebankParserParams.RemoveGFSubcategoryStripper, AbstractTreebankParserParams.SubcategoryStripper| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,Pair<java.lang.String,java.util.function.Function<TregexMatcher,java.lang.String>>> |
annotations
This data structure dictates how an arbitrary tree should be
annotated.
|
evalGF, generateOriginalDependencies, inputEncoding, outputEncoding, tlp| Constructor and Description |
|---|
TregexPoweredTreebankParserParams(TreebankLanguagePack tlp) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addFeature(java.lang.String featureName)
Enable an annotation feature.
|
protected abstract java.lang.String[] |
baselineAnnotationFeatures()
Features which should be enabled by default.
|
protected void |
compileAnnotations(HeadFinder hf)
Compile the
annotations collection given a
particular head finder. |
void |
display()
Output a description of the current annotation configuration to
standard error.
|
protected java.lang.String |
getAnnotationString(Tree t,
Tree root)
Build a string of annotations for the given tree.
|
protected void |
removeFeature(java.lang.String featureName)
Disable a feature.
|
Tree |
transformTree(Tree t,
Tree root)
This method does language-specific tree transformations such as annotating particular nodes with language-relevant
features.
|
collinizer, collinizerEvalb, defaultCoreNLPFlags, dependencyGrammarExtractor, dependencyObjectify, diskTreebank, generateOriginalDependencies, getGrammaticalStructure, getInputEncoding, getOutputEncoding, headFinder, isEvalGF, lex, memoryTreebank, MLEDependencyGrammarSmoothingParams, parsevalObjectify, parsevalObjectify, ppAttachmentEval, processHeadWord, pw, pw, readGrammaticalStructureFromFile, setEvalGF, setEvaluateGrammaticalFunctions, setGenerateOriginalDependencies, setInputEncoding, setOptionFlag, setOutputEncoding, sisterSplitters, subcategoryStripper, supportsBasicDependencies, testMemoryTreebank, treebank, treebankLanguagePack, treeTokenizerFactory, typedDependencyClasser, typedDependencyHeadFinder, typedDependencyObjectify, unorderedTypedDependencyObjectify, unorderedUntypedDependencyObjectify, untypedDependencyObjectifyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdefaultTestSentence, treeReaderFactoryprotected final java.util.Map<java.lang.String,Pair<java.lang.String,java.util.function.Function<TregexMatcher,java.lang.String>>> annotations
public TregexPoweredTreebankParserParams(TreebankLanguagePack tlp)
protected abstract java.lang.String[] baselineAnnotationFeatures()
protected void compileAnnotations(HeadFinder hf)
annotations collection given a
particular head finder. Subclasses should call this method at
least once before the class is used, and whenever the head finder
is changed.protected void addFeature(java.lang.String featureName)
featureName - java.lang.IllegalArgumentException - If the provided feature
name is unknown (i.e., if there is no entry in the
annotations collection with the same name)protected void removeFeature(java.lang.String featureName)
featureName - public Tree transformTree(Tree t, Tree root)
t. It changes both labels and the tree shape.transformTree in interface TreebankLangParserParamstransformTree in class AbstractTreebankParserParamst - The input tree (with non-language specific annotation already done, so you need to strip back to basic
categories)root - The root of the current tree (can be null for words)protected java.lang.String getAnnotationString(Tree t, Tree root)
t - The input tree (with non-language specific annotation
already done, so you need to strip back to basic categories)root - The root of the current tree (can be null for words)public void display()
display in interface TreebankLangParserParamsdisplay in class AbstractTreebankParserParams