apply_semantic_suggestions

apply_semantic_suggestions(
    dict_df,
    suggestions=None,
    strategy='top',
    columns=None,
    roles=None,
    min_score=None,
    min_llm_confidence=None,
    overwrite=False,
    verbose=True,
)

Apply selected column-level semantic suggestions to a dictionary.

Parameters

Name Type Description Default
dict_df pd.DataFrame Dictionary to update. required
suggestions Optional[pd.DataFrame] Candidate table. When omitted, uses dict_df.attrs["semantic_suggestions"]. None
strategy str "top" keeps the original lexical ranking and chooses the first filtered candidate. "reviewed" applies only rows whose decision is accepted (or the equivalent accept). "llm" requires a reviewed candidate with decision accept. When reviewed or LLM-reviewed selections contain multiple constraints for one measurement, their IRIs are deduplicated in first-occurrence order and written to constraint_iri as the SDP-compatible semicolon-separated value. Other roles continue to select one value per column-role pair, and "top" stays single-winner for every role. 'top'
roles Optional[Sequence[str]] Optional semantic-role filter; None applies every role, leaving the per-suggestion gates in _filter_auto_apply_suggestions() as the only restriction. create_sdp()’s LLM path passes the four core roles (variable, property, entity, unit); its deterministic path passes None, because for constraint_iri and statistical_modifier_iri the gate that matters is evidence in the column’s own text, not the role name. See package_io._auto_apply_package_suggestions() and PARITY.md row 57. None
overwrite bool Replace existing IRIs when True. Existing values are preserved by default. False

Returns

Name Type Description
pandas.DataFrame Updated normalized dictionary.
Back to top