Dedup values
dedup_values
Dedup-values strategy — collapse repeated string values in JSON.
DedupValuesStrategy
Bases: SmeltStrategy
Replace frequently repeated long string values with aliases.
Source code in packages/axm-smelt/src/axm_smelt/strategies/dedup_values.py
category
property
Strategy category (structural).
name
property
Strategy identifier used in the registry.
apply(ctx)
Replace repeated long strings with short aliases.
Uses ctx.parsed when available to skip
json.loads. Wraps the result in a {_refs, _data}
envelope.
The keys _refs and _data are reserved for the output
envelope. If the input is a dict that already contains either
as a top-level key, the strategy is a pass-through to avoid
silent collision in the wrapped output.
Source code in packages/axm-smelt/src/axm_smelt/strategies/dedup_values.py
collect_strings(data, strings)
Walk data and collect string values.
Source code in packages/axm-smelt/src/axm_smelt/strategies/dedup_values.py
replace_strings(data, lookup)
Replace repeated string values with short aliases.