executor
executor
¶
Plan-driven structured replacement execution.
Classes:
| Name | Description |
|---|---|
ReplacementExecutionResult |
Internal structured-execution result returned to the public facade. |
ReplacementExecutor |
Execute a replacement plan's structured and free-text columns in dependency order on a dataframe copy. |
ReplacementExecutionResult(dataframe, column_statistics, generation_statistics, dependency_drifts, replacement_map)
dataclass
¶
Internal structured-execution result returned to the public facade.
Attributes:
| Name | Type | Description |
|---|---|---|
dataframe |
DataFrame
|
Copy of the input with every structured target replaced. |
column_statistics |
dict[str, ColumnStatistics]
|
Per-column replacement metadata, keyed by column name. |
generation_statistics |
ReplacementGenerationStatistics
|
Aggregate generation counts and timing. |
dependency_drifts |
tuple[GroupDependencyDrift, ...]
|
Group mappings reused although their dependency values changed. |
replacement_map |
ReplacementMap | None
|
Per-occurrence original and replacement values when capture was requested, otherwise |
dataframe
instance-attribute
¶
Copy of the input with every structured target replaced.
column_statistics
instance-attribute
¶
Per-column replacement metadata, keyed by column name.
generation_statistics
instance-attribute
¶
Aggregate generation counts and timing.
dependency_drifts
instance-attribute
¶
Group mappings reused although their dependency values changed.
replacement_map
instance-attribute
¶
Per-occurrence original and replacement values when capture was requested, otherwise None.
ReplacementExecutor(plan, generator, *, group_column, base_seed, free_text_detector=None, capture_replacement_map=False, find_and_replace=False, locale='en_US')
¶
Execute a replacement plan's structured and free-text columns in dependency order on a dataframe copy.
Methods:
| Name | Description |
|---|---|
execute |
Return a copy with every structured plan target replaced. |
detect |
Return the column statistics |
Source code in src/nemo_safe_synthesizer/pii_replacer/replacement/executor.py
execute(dataframe)
¶
Return a copy with every structured plan target replaced.
Source code in src/nemo_safe_synthesizer/pii_replacer/replacement/executor.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
detect(dataframe)
¶
Return the column statistics execute reports, without generating or writing any replacement.
Structured targets report their non-missing original values. Free-text targets report the spans
execute would replace: detector spans and, with find_and_replace, matches of known values.
Each structured value is registered for that matching as its own replacement, so no generator is
called. The matches are those of execute, except that a full name always contributes its name
words here, while execute skips them when the replacement has a different number of words.
Example
With PII replacement off, the pipeline calls this on the training split so PII replay can still count which original values reappear in the synthetic data.