refine_by_rulebook: Iteratively refine semantic assertions using a rulebook

View source: R/refine_by_rulebook.R

refine_by_rulebookR Documentation

Iteratively refine semantic assertions using a rulebook

Description

Apply a compiled semantic rulebook sequentially to a target semantic assertion vector.

Usage

refine_by_rulebook(
  x,
  target,
  rulebook,
  prefix = NULL,
  keep_intermediate = TRUE,
  final_name = "final"
)

Arguments

x

A data frame.

target

Bare or quoted name of the initial semantic assertion column.

rulebook

A compiled rulebook object created with compile_rulebook().

prefix

Prefix used for generated refinement columns. Defaults to the target column name.

keep_intermediate

Logical. If TRUE, keeps all intermediate refinement columns. If FALSE, returns only the final refinement column.

final_name

Name of the final refinement column.

Details

refine_by_rulebook() wraps an iterative refinement workflow where each semantic refinement stage operates on the semantic state produced by the previous stage.

The function is designed for operational semantic stabilization workflows where semantic assertions progressively mature through deterministic contextual refinement.

Each refinement stage creates a new refinement column, preserving semantic progression for inspection, auditing, and review.

Rulebooks are typically created with compile_rulebook() and operate on semantic operationalisations produced with:

  • prelabel();

  • as.character();

  • as_character();

  • refine().

Conceptually, the function behaves similarly to an iterative purrr::reduce() workflow applied to semantic refinement stages.

Value

A tibble with progressively refined semantic assertions.

See Also

refine(), compile_rulebook()


fscontext documentation built on Nov. 19, 2026, 5:11 p.m.