Package com.gengoai.hermes.extraction
Class MultiPhaseExtractor.MultiPhaseExtractorBuilder<T extends MultiPhaseExtractor,V extends MultiPhaseExtractor.MultiPhaseExtractorBuilder<T,V>>
- java.lang.Object
-
- com.gengoai.hermes.extraction.MultiPhaseExtractor.MultiPhaseExtractorBuilder<T,V>
-
- Direct Known Subclasses:
NGramExtractor.Builder
,TermExtractor.Builder
- Enclosing class:
- MultiPhaseExtractor
protected abstract static class MultiPhaseExtractor.MultiPhaseExtractorBuilder<T extends MultiPhaseExtractor,V extends MultiPhaseExtractor.MultiPhaseExtractorBuilder<T,V>> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected @NonNull AnnotationType[]
annotationTypes
protected LyreExpression
filter
protected String
prefix
protected @NonNull LyreExpression
toString
protected LyreExpression
trim
protected @NonNull ValueCalculator
valueCalculator
-
Constructor Summary
Constructors Modifier Constructor Description protected
MultiPhaseExtractorBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description V
annotations(AnnotationType... types)
The annotations to base the extraction onV
annotations(List<AnnotationType> types)
The annotations to base the extraction onabstract T
build()
V
filter(LyreExpression expression)
Sets the filter to use to eliminate annotations from the extractionV
filter(String expression)
Sets the filter to use to eliminate annotations from the extractionV
fromExtractor(@NonNull MultiPhaseExtractor extractor)
Copies the values from the given extractor to this builderV
ignoreStopwords()
Set the filter to ignore stopwords.V
prefix(String prefix)
Sets the prefix to use when building features.V
toLemma()
Set the toString method to use the lemma form of the annotation.V
toLowerCase()
Set the toString method to use the lowercase form of the annotation.V
toString(LyreExpression expression)
Sets the method for mapping annotations to Strings.V
toString(String expression)
Sets the method for mapping annotations to Strings.V
trim(LyreExpression expression)
Sets the method for trimming annotations.V
trim(String expression)
Sets the method for trimming annotations.V
valueCalculator(ValueCalculator valueCalculator)
Sets the method for calculating the final values in counter-based extraction
-
-
-
Field Detail
-
annotationTypes
@NonNull protected @NonNull AnnotationType[] annotationTypes
-
filter
protected LyreExpression filter
-
prefix
protected String prefix
-
toString
@NonNull protected @NonNull LyreExpression toString
-
trim
protected LyreExpression trim
-
valueCalculator
@NonNull protected @NonNull ValueCalculator valueCalculator
-
-
Method Detail
-
annotations
public V annotations(List<AnnotationType> types)
The annotations to base the extraction on- Parameters:
types
- the annotation types- Returns:
- this builder
-
annotations
public V annotations(AnnotationType... types)
The annotations to base the extraction on- Parameters:
types
- the annotation types- Returns:
- this builder
-
build
public abstract T build()
- Returns:
- the constructed Extractor from this builder
-
filter
public V filter(LyreExpression expression)
Sets the filter to use to eliminate annotations from the extraction- Parameters:
expression
- the Lyre expression to use as the filter.- Returns:
- this builder
-
filter
public V filter(String expression)
Sets the filter to use to eliminate annotations from the extraction- Parameters:
expression
- the Lyre expression to use as the filter.- Returns:
- this builder
-
fromExtractor
public V fromExtractor(@NonNull @NonNull MultiPhaseExtractor extractor)
Copies the values from the given extractor to this builder- Parameters:
extractor
- the extractor to copy from- Returns:
- this extractor
-
ignoreStopwords
public V ignoreStopwords()
Set the filter to ignore stopwords.- Returns:
- this builder
-
prefix
public V prefix(String prefix)
Sets the prefix to use when building features.- Parameters:
prefix
- the feature prefix- Returns:
- this builder
-
toLemma
public V toLemma()
Set the toString method to use the lemma form of the annotation.- Returns:
- this builder
-
toLowerCase
public V toLowerCase()
Set the toString method to use the lowercase form of the annotation.- Returns:
- this builder
-
toString
public V toString(String expression)
Sets the method for mapping annotations to Strings.- Parameters:
expression
- the Lyre expression to use for mapping.- Returns:
- this builder
-
toString
public V toString(LyreExpression expression)
Sets the method for mapping annotations to Strings.- Parameters:
expression
- the Lyre expression to use for mapping.- Returns:
- this builder
-
trim
public V trim(String expression)
Sets the method for trimming annotations.- Parameters:
expression
- the Lyre expression to use for trimming.- Returns:
- this builder
-
trim
public V trim(LyreExpression expression)
Sets the method for trimming annotations.- Parameters:
expression
- the Lyre expression to use for trimming.- Returns:
- this builder
-
valueCalculator
public V valueCalculator(ValueCalculator valueCalculator)
Sets the method for calculating the final values in counter-based extraction- Parameters:
valueCalculator
- the value calculator- Returns:
- this builder
-
-