PostProcessor

Trait PostProcessor 

Source
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§

Source

type Record

The type of records this processor modifies.

Source

type Label

The type of labels this processor produces.

Required Methods§

Source

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.

Source

fn name(&self) -> &'static str

Get the name of this processor.

Source

fn is_enabled(&self) -> bool

Check if this processor is enabled.

Source

fn stats(&self) -> ProcessorStats

Get processing statistics.

Source

fn reset_stats(&mut self)

Reset statistics (for testing or between batches).

Provided Methods§

Source

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.

Implementors§