
Apply user answers to structured clarification questions
Source:R/translator-nl.R
answer_clarifications.RdUpdates a spec_ir using a named list of clarification answers (keyed by
clarification id or dotted IR path), updates defaults_rationale to
record user confirmation, validates the specification, and returns the
updated spec_ir alongside a semantic spec_diff.
Arguments
- spec
A
spec_irorspec_translationobject.- answers
Named list mapping clarification IDs (or IR paths) to chosen values.
- clarifications
Optional list of clarification objects (automatically extracted if
specis aspec_translation).- validate
Logical; if
TRUE(default), enforcesassert_valid_spec_ir().
Examples
res <- nl_to_spec("2-level power analysis")
updated <- answer_clarifications(res, list(n_clusters = 60, icc = 0.25))
updated$diff
#>
#> ── spec_diff (2 changes across 1 section)
#> • hierarchy.n_clusters: 40 -> 60
#> • hierarchy.icc: 0.15 -> 0.25