pub trait PostProcessor: Send + Sync {
type Record;
type Label;
// Required methods
fn process(
&mut self,
record: &mut Self::Record,
context: &ProcessContext,
) -> SynthResult<Vec<Self::Label>>;
fn name(&self) -> &'static str;
fn is_enabled(&self) -> bool;
fn stats(&self) -> ProcessorStats;
fn reset_stats(&mut self);
// Provided method
fn process_batch(
&mut self,
records: &mut [Self::Record],
base_context: &ProcessContext,
) -> SynthResult<Vec<Self::Label>> { ... }
}Expand description
Core trait for post-processors that modify records and generate labels.
Post-processors are applied after generation to inject realistic data quality issues. Each processor can modify records in place and generate labels describing the modifications for ML training.
Required Associated Types§
Required Methods§
Sourcefn process(
&mut self,
record: &mut Self::Record,
context: &ProcessContext,
) -> SynthResult<Vec<Self::Label>>
fn process( &mut self, record: &mut Self::Record, context: &ProcessContext, ) -> SynthResult<Vec<Self::Label>>
Process a single record, potentially modifying it and generating labels.
Returns a vector of labels describing any modifications made.
Sourcefn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Check if this processor is enabled.
Sourcefn stats(&self) -> ProcessorStats
fn stats(&self) -> ProcessorStats
Get processing statistics.
Sourcefn reset_stats(&mut self)
fn reset_stats(&mut self)
Reset statistics (for testing or between batches).
Provided Methods§
Sourcefn process_batch(
&mut self,
records: &mut [Self::Record],
base_context: &ProcessContext,
) -> SynthResult<Vec<Self::Label>>
fn process_batch( &mut self, records: &mut [Self::Record], base_context: &ProcessContext, ) -> SynthResult<Vec<Self::Label>>
Process a batch of records.
Default implementation calls process for each record.