public class MatchedExpression
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
MatchedExpression.SingleAnnotationExtractor
Function that takes a CoreMap, applies an extraction function to it, to get a value.
|
Modifier and Type | Field and Description |
---|---|
protected CoreMap |
annotation |
protected Interval<java.lang.Integer> |
charOffsets
Character offsets (relative to original text).
|
protected Interval<java.lang.Integer> |
chunkOffsets
Chunk offsets (relative to chunking on top of original text)
|
protected java.lang.Object |
context
Function indicating how to extract an value from annotation built from this expression
|
static java.util.function.Function<CoreMap,Interval<java.lang.Integer>> |
COREMAP_TO_CHAR_OFFSETS_INTERVAL_FUNC |
static java.util.function.Function<CoreMap,Interval<java.lang.Integer>> |
COREMAP_TO_TOKEN_OFFSETS_INTERVAL_FUNC |
static java.util.Comparator<MatchedExpression> |
EXPR_LENGTH_COMPARATOR |
static java.util.Comparator<MatchedExpression> |
EXPR_LENGTH_PRIORITY_COMPARATOR |
static java.util.Comparator<MatchedExpression> |
EXPR_ORDER_COMPARATOR |
static java.util.Comparator<MatchedExpression> |
EXPR_PRIORITY_COMPARATOR |
static java.util.Comparator<MatchedExpression> |
EXPR_PRIORITY_LENGTH_COMPARATOR |
static java.util.function.Function<MatchedExpression,Interval<java.lang.Integer>> |
EXPR_TO_TOKEN_OFFSETS_INTERVAL_FUNC |
static java.util.Comparator<MatchedExpression> |
EXPR_TOKEN_OFFSET_COMPARATOR |
static java.util.Comparator<MatchedExpression> |
EXPR_TOKEN_OFFSETS_NESTED_FIRST_COMPARATOR |
static java.util.function.ToDoubleFunction<MatchedExpression> |
EXPR_WEIGHT_SCORER |
protected MatchedExpression.SingleAnnotationExtractor |
extractFunc |
protected java.lang.String |
text
Text representing the matched expression
|
protected Interval<java.lang.Integer> |
tokenOffsets
Token offsets (relative to original text tokenization)
|
Value |
value |
Constructor and Description |
---|
MatchedExpression(Interval<java.lang.Integer> charOffsets,
Interval<java.lang.Integer> tokenOffsets,
MatchedExpression.SingleAnnotationExtractor extractFunc,
double priority,
double weight) |
MatchedExpression(MatchedExpression me) |
Modifier and Type | Method and Description |
---|---|
boolean |
extractAnnotation(Env env,
CoreMap sourceAnnotation) |
boolean |
extractAnnotation(Env env,
java.util.List<? extends CoreMap> source) |
protected boolean |
extractAnnotation(java.util.List<? extends CoreMap> source,
CoreMapAggregator aggregator) |
CoreMap |
getAnnotation() |
static <T extends MatchedExpression> |
getBestMatched(java.util.List<T> matches,
java.util.function.ToDoubleFunction<MatchedExpression> scorer) |
Interval<java.lang.Integer> |
getCharOffsets() |
Interval<java.lang.Integer> |
getChunkOffsets() |
int |
getOrder() |
double |
getPriority() |
java.lang.String |
getText() |
Interval<java.lang.Integer> |
getTokenOffsets() |
Value |
getValue() |
double |
getWeight() |
boolean |
isIncludeNested() |
static <T extends MatchedExpression> |
removeNested(java.util.List<T> chunks) |
static <T extends MatchedExpression> |
removeNullValues(java.util.List<T> chunks) |
static <T extends MatchedExpression> |
removeOverlapping(java.util.List<T> chunks) |
static java.util.List<? extends CoreMap> |
replaceMerged(java.util.List<? extends CoreMap> list,
java.util.List<? extends MatchedExpression> matchedExprs) |
static java.util.List<? extends CoreMap> |
replaceMergedUsingTokenOffsets(java.util.List<? extends CoreMap> list,
java.util.List<? extends MatchedExpression> matchedExprs) |
void |
setIncludeNested(boolean includeNested) |
java.lang.String |
toString() |
protected java.lang.String text
protected Interval<java.lang.Integer> charOffsets
protected Interval<java.lang.Integer> tokenOffsets
protected Interval<java.lang.Integer> chunkOffsets
protected CoreMap annotation
protected java.lang.Object context
protected MatchedExpression.SingleAnnotationExtractor extractFunc
public Value value
public static final java.util.function.Function<CoreMap,Interval<java.lang.Integer>> COREMAP_TO_TOKEN_OFFSETS_INTERVAL_FUNC
public static final java.util.function.Function<CoreMap,Interval<java.lang.Integer>> COREMAP_TO_CHAR_OFFSETS_INTERVAL_FUNC
public static final java.util.function.Function<MatchedExpression,Interval<java.lang.Integer>> EXPR_TO_TOKEN_OFFSETS_INTERVAL_FUNC
public static final java.util.Comparator<MatchedExpression> EXPR_PRIORITY_COMPARATOR
public static final java.util.Comparator<MatchedExpression> EXPR_ORDER_COMPARATOR
public static final java.util.Comparator<MatchedExpression> EXPR_LENGTH_COMPARATOR
public static final java.util.Comparator<MatchedExpression> EXPR_TOKEN_OFFSET_COMPARATOR
public static final java.util.Comparator<MatchedExpression> EXPR_TOKEN_OFFSETS_NESTED_FIRST_COMPARATOR
public static final java.util.Comparator<MatchedExpression> EXPR_PRIORITY_LENGTH_COMPARATOR
public static final java.util.Comparator<MatchedExpression> EXPR_LENGTH_PRIORITY_COMPARATOR
public static final java.util.function.ToDoubleFunction<MatchedExpression> EXPR_WEIGHT_SCORER
public MatchedExpression(MatchedExpression me)
public MatchedExpression(Interval<java.lang.Integer> charOffsets, Interval<java.lang.Integer> tokenOffsets, MatchedExpression.SingleAnnotationExtractor extractFunc, double priority, double weight)
public boolean extractAnnotation(Env env, java.util.List<? extends CoreMap> source)
protected boolean extractAnnotation(java.util.List<? extends CoreMap> source, CoreMapAggregator aggregator)
public Interval<java.lang.Integer> getCharOffsets()
public Interval<java.lang.Integer> getTokenOffsets()
public Interval<java.lang.Integer> getChunkOffsets()
public double getPriority()
public double getWeight()
public int getOrder()
public boolean isIncludeNested()
public void setIncludeNested(boolean includeNested)
public java.lang.String getText()
public CoreMap getAnnotation()
public Value getValue()
public java.lang.String toString()
toString
in class java.lang.Object
public static java.util.List<? extends CoreMap> replaceMerged(java.util.List<? extends CoreMap> list, java.util.List<? extends MatchedExpression> matchedExprs)
public static java.util.List<? extends CoreMap> replaceMergedUsingTokenOffsets(java.util.List<? extends CoreMap> list, java.util.List<? extends MatchedExpression> matchedExprs)
public static <T extends MatchedExpression> java.util.List<T> removeNullValues(java.util.List<T> chunks)
public static <T extends MatchedExpression> java.util.List<T> removeNested(java.util.List<T> chunks)
public static <T extends MatchedExpression> java.util.List<T> removeOverlapping(java.util.List<T> chunks)
public static <T extends MatchedExpression> T getBestMatched(java.util.List<T> matches, java.util.function.ToDoubleFunction<MatchedExpression> scorer)