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 FormModifier 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 Map<String,Pair<String,java.util.function.Function<TregexMatcher,String>>> |
annotations
This data structure dictates how an arbitrary tree should be
annotated.
|
evalGF, inputEncoding, outputEncoding, tlp
Constructor and Description |
---|
TregexPoweredTreebankParserParams(TreebankLanguagePack tlp) |
Modifier and Type | Method and Description |
---|---|
protected void |
addFeature(String featureName)
Enable an annotation feature.
|
protected abstract 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 String |
getAnnotationString(Tree t,
Tree root)
Build a string of annotations for the given tree.
|
protected void |
removeFeature(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, getGrammaticalStructure, getInputEncoding, getOutputEncoding, headFinder, isEvalGF, lex, memoryTreebank, MLEDependencyGrammarSmoothingParams, parsevalObjectify, parsevalObjectify, ppAttachmentEval, processHeadWord, pw, pw, readGrammaticalStructureFromFile, setEvalGF, setEvaluateGrammaticalFunctions, setInputEncoding, setOptionFlag, setOutputEncoding, sisterSplitters, subcategoryStripper, supportsBasicDependencies, testMemoryTreebank, treebank, treebankLanguagePack, treeTokenizerFactory, typedDependencyClasser, typedDependencyHeadFinder, typedDependencyObjectify, unorderedTypedDependencyObjectify, unorderedUntypedDependencyObjectify, untypedDependencyObjectify
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
defaultTestSentence, treeReaderFactory
protected final Map<String,Pair<String,java.util.function.Function<TregexMatcher,String>>> annotations
public TregexPoweredTreebankParserParams(TreebankLanguagePack tlp)
protected abstract 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(String featureName)
featureName
- 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(String featureName)
featureName
- public Tree transformTree(Tree t, Tree root)
t
. It changes both labels and the tree shape.transformTree
in interface TreebankLangParserParams
transformTree
in class AbstractTreebankParserParams
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)protected 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 TreebankLangParserParams
display
in class AbstractTreebankParserParams