public class TypePathExtractor<T extends Annotation> extends Object implements NamedFeatureExtractor1<T>
| Constructor and Description |
|---|
TypePathExtractor(Class<T> focusClass,
String typePath)
calls this(type, typePath, false, false, true, jCas)
|
TypePathExtractor(Class<T> focusClass,
String typePath,
boolean traverseAllPaths,
boolean returnAllValues,
boolean uniqueValues)
This extractor creates features from attributes of an annotation.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
createName(String namePrefix,
String typePath)
WARNING: this method is public for TypePathFeature backwards compatibility, but should not be
used by anyone else!
|
List<Feature> |
extract(JCas view,
Annotation focusAnnotation)
Some feature extractors will require some specific number of annotations that is greater than
one.
|
String |
getFeatureName()
Gets the name that will be used for all features created by this feature extractor.
|
Class<? extends Annotation> |
getFocusClass() |
String |
getPath() |
boolean |
isAllPaths() |
boolean |
isAllValues() |
boolean |
isUniqueValues() |
static boolean |
isValidPath(Type type,
String path,
JCas view) |
static boolean |
isValidType(Type type,
TypeSystem typeSystem) |
public TypePathExtractor(Class<T> focusClass, String typePath)
public TypePathExtractor(Class<T> focusClass, String typePath, boolean traverseAllPaths, boolean returnAllValues, boolean uniqueValues)
focusClass - the type of annotation that you are doing feature extraction on.typePath - a string representation of the path that should be traversed to extract a feature
value (e.g. "resourceEntry/dbRecord/identifier" or "pos" from the examples above.)traverseAllPaths - The path you traverse to the value you are trying to retrieve may include attributes
that have multiple-values. If true, then all paths are examined and features for each
traversal are added if possible. If false, then the first path that results in a
non-null value will be examined.returnAllValues - The last node of the path may be multi-valued. If true, then all values found in the
last node will be returned as features. If false, then only the first value of the
last node is returned. If traverseAllPaths and returnAllValues are both false, then a
list of size 0 or 1 will be returned. The other three combinations are each valid and
may return a list of size 0 or greater.uniqueValues - if true, then the returned values of the extract method will be unique.public static String createName(String namePrefix, String typePath)
public List<Feature> extract(JCas view, Annotation focusAnnotation) throws CleartkExtractorException
FeatureExtractor1extract in interface FeatureExtractor1<T extends Annotation>view - the current view of the document.focusAnnotation - the annotation for which to collect features.CleartkExtractorExceptionpublic String getFeatureName()
NamedFeatureExtractor1getFeatureName in interface NamedFeatureExtractor1<T extends Annotation>public Class<? extends Annotation> getFocusClass()
public boolean isAllPaths()
public boolean isAllValues()
public boolean isUniqueValues()
public static boolean isValidPath(Type type, String path, JCas view)
public static boolean isValidType(Type type, TypeSystem typeSystem)
Copyright © 2014. All rights reserved.