Package com.gengoai.hermes.extraction
Class MultiPhaseExtractor
- java.lang.Object
-
- com.gengoai.apollo.ml.feature.Featurizer<HString>
-
- com.gengoai.hermes.extraction.FeaturizingExtractor
-
- com.gengoai.hermes.extraction.MultiPhaseExtractor
-
- All Implemented Interfaces:
FeatureExtractor<HString>
,ObservationExtractor<HString>
,Copyable<FeaturizingExtractor>
,Extractor
,Serializable
- Direct Known Subclasses:
NGramExtractor
,TermExtractor
public abstract class MultiPhaseExtractor extends FeaturizingExtractor implements Copyable<FeaturizingExtractor>
A
FeaturizingExtractor
that breaks the extraction process into the follow parts:- Extracts annotations of the given types.
- Trims the extractions, if a trim method is defined.
- Filters the extractions, if a trim method is defined.
toString
method is provided to map the extracted HString into a String representation. Additionally, a ValueCalculator that defines how the extractions are counted.- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
MultiPhaseExtractor.MultiPhaseExtractorBuilder<T extends MultiPhaseExtractor,V extends MultiPhaseExtractor.MultiPhaseExtractorBuilder<T,V>>
-
Constructor Summary
Constructors Constructor Description MultiPhaseExtractor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description List<Variable>
applyAsFeatures(@NonNull HString input)
FeaturizingExtractor
copy()
protected abstract Stream<HString>
createStream(HString hString)
Creates a stream of extractions from the given inputExtraction
extract(@NonNull HString hString)
Generate anExtraction
from the givenHString
.abstract MultiPhaseExtractor.MultiPhaseExtractorBuilder<?,?>
toBuilder()
Converts the Extractor into a builder.String
toString()
-
Methods inherited from class com.gengoai.apollo.ml.feature.Featurizer
booleanFeaturizer, chain, chain, countFeaturizer, extractObservation, multiValueFeaturizer, predicateFeaturizer, realFeaturizer, valueFeaturizer, valueFeaturizer, withContext, withContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.gengoai.apollo.ml.feature.FeatureExtractor
contextualize, extractSequence
-
-
-
-
Method Detail
-
applyAsFeatures
public final List<Variable> applyAsFeatures(@NonNull @NonNull HString input)
- Specified by:
applyAsFeatures
in classFeaturizer<HString>
-
copy
public FeaturizingExtractor copy()
- Specified by:
copy
in interfaceCopyable<FeaturizingExtractor>
-
createStream
protected abstract Stream<HString> createStream(HString hString)
Creates a stream of extractions from the given input- Parameters:
hString
- the input text- Returns:
- the stream of extractions
-
extract
public Extraction extract(@NonNull @NonNull HString hString)
Description copied from interface:Extractor
Generate anExtraction
from the givenHString
.
-
toBuilder
public abstract MultiPhaseExtractor.MultiPhaseExtractorBuilder<?,?> toBuilder()
Converts the Extractor into a builder.- Returns:
- the builder initialized with values from this extractor
-
-