Class SimpleFieldExtractor<T>
java.lang.Object
org.tribuo.data.columnar.extractors.SimpleFieldExtractor<T>
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>,FieldExtractor<T>
- Direct Known Subclasses:
DateExtractor,DoubleExtractor,FloatExtractor,IdentityExtractor,IntExtractor,OffsetDateTimeExtractor
Extracts a value from a single field to be placed in an
Example's metadata field.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFor olcut.protectedSimpleFieldExtractor(String fieldName) Constructs a simple field extractor which reads from the supplied field name and writes out to a metadata field with the same name.protectedSimpleFieldExtractor(String fieldName, String metadataName) Constructs a simple field extractor with the supplied field name and metadata field name. -
Method Summary
Modifier and TypeMethodDescriptionReturns Optional which is filled if extraction succeeded.extractField(String fieldValue) Extracts the field value, or returnsOptional.empty()if it failed to parse.Gets the field name this extractor operates on.Gets the metadata key name.voidUsed by the OLCUT configuration system, and should not be called by external code.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.tribuo.data.columnar.FieldExtractor
getValueTypeMethods inherited from interface com.oracle.labs.mlrg.olcut.provenance.Provenancable
getProvenance
-
Field Details
-
fieldName
-
metadataName
@Config(description="The metadata key to emit, defaults to field name if unpopulated") protected String metadataName
-
-
Constructor Details
-
SimpleFieldExtractor
Constructs a simple field extractor which reads from the supplied field name and writes out to a metadata field with the same name.- Parameters:
fieldName- The field name to read from.
-
SimpleFieldExtractor
-
SimpleFieldExtractor
protected SimpleFieldExtractor()For olcut.
-
-
Method Details
-
postConfig
public void postConfig()Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfigin interfacecom.oracle.labs.mlrg.olcut.config.Configurable
-
getFieldName
Gets the field name this extractor operates on.- Returns:
- The field name.
-
getMetadataName
Gets the metadata key name. This is the key into which this value will be written in anExampleif it is given toRowProcessor.Defaults to the field name.
- Specified by:
getMetadataNamein interfaceFieldExtractor<T>- Returns:
- The metadata key name.
-
extractField
Extracts the field value, or returnsOptional.empty()if it failed to parse.- Parameters:
fieldValue- The field value to read.- Returns:
- The extracted value.
-
extract
Description copied from interface:FieldExtractorReturns Optional which is filled if extraction succeeded.- Specified by:
extractin interfaceFieldExtractor<T>- Parameters:
row- The raw row from which to extract a value- Returns:
- A value.
-
toString
-