Class DateFieldProcessor
java.lang.Object
org.tribuo.data.columnar.processors.field.DateFieldProcessor
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>,FieldProcessor
Processes a column that contains a date value. The features are named
based on the column name and the feature type extracted.
This class uses LocalDate
Returns an empty list if the date failed to parse or was empty.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe types of date features which can be extracted.Nested classes/interfaces inherited from interface org.tribuo.data.columnar.FieldProcessor
FieldProcessor.GeneratedFeatureType -
Field Summary
Fields inherited from interface org.tribuo.data.columnar.FieldProcessor
NAMESPACE -
Constructor Summary
ConstructorsConstructorDescriptionDateFieldProcessor(String fieldName, EnumSet<DateFieldProcessor.DateFeatureType> featureTypes, String dateFormat) Constructs a field processor which parses a date from the specified field name using the supplied format string then extracts date features according to the suppliedEnumSet.DateFieldProcessor(String fieldName, EnumSet<DateFieldProcessor.DateFeatureType> featureTypes, String dateFormat, String localeLanguage, String localeCountry) Constructs a field processor which parses a date from the specified field name using the supplied format string then extracts date features according to the suppliedEnumSet. -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of this FieldProcessor bound to the supplied newFieldName.Returns the feature type this FieldProcessor generates.Gets the field name this FieldProcessor uses.com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenancevoidUsed by the OLCUT configuration system, and should not be called by external code.Processes the field value and generates a (possibly empty) list ofColumnarFeatures.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.FieldProcessor
getNumNamespaces
-
Constructor Details
-
DateFieldProcessor
public DateFieldProcessor(String fieldName, EnumSet<DateFieldProcessor.DateFeatureType> featureTypes, String dateFormat) Constructs a field processor which parses a date from the specified field name using the supplied format string then extracts date features according to the suppliedEnumSet.Defaults to
Locale.US.Throws
IllegalArgumentExceptionif the date format is invalid.- Parameters:
fieldName- The field name to read.featureTypes- The features to extract.dateFormat- The date format to use.
-
DateFieldProcessor
public DateFieldProcessor(String fieldName, EnumSet<DateFieldProcessor.DateFeatureType> featureTypes, String dateFormat, String localeLanguage, String localeCountry) Constructs a field processor which parses a date from the specified field name using the supplied format string then extracts date features according to the suppliedEnumSet.Throws
IllegalArgumentExceptionif the date format is invalid.- Parameters:
fieldName- The field name to read.featureTypes- The features to extract.dateFormat- The date format to use.localeLanguage- The Locale language.localeCountry- The Locale country.
-
-
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
Description copied from interface:FieldProcessorGets the field name this FieldProcessor uses.- Specified by:
getFieldNamein interfaceFieldProcessor- Returns:
- The field name.
-
process
Description copied from interface:FieldProcessorProcesses the field value and generates a (possibly empty) list ofColumnarFeatures.- Specified by:
processin interfaceFieldProcessor- Parameters:
value- The field value to process.- Returns:
- A list of
ColumnarFeatures.
-
getFeatureType
Description copied from interface:FieldProcessorReturns the feature type this FieldProcessor generates.- Specified by:
getFeatureTypein interfaceFieldProcessor- Returns:
- The feature type.
-
copy
Description copied from interface:FieldProcessorReturns a copy of this FieldProcessor bound to the supplied newFieldName.- Specified by:
copyin interfaceFieldProcessor- Parameters:
newFieldName- The new field name for the copy.- Returns:
- A copy of this FieldProcessor.
-
toString
-
getProvenance
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-