finalize_textcleaner: Finalize a 'textcleaner()' Result

View source: R/finalize_textcleaner.R

finalize_textcleanerR Documentation

Finalize a textcleaner() Result

Description

Reviews automated spell-check corrections and builds the final cleaned/binary/behavioral output – the exact logic textcleaner itself runs once, internally, via a pure code motion. Exposed so textcleaner_shiny's corrections-review module can re-run this same, already-tested logic a second time once the user's real edits (from the embedded automated_edit_server) are known, instead of duplicating it. Byte-identical behavior to textcleaner()'s own original inline block, covered by the full test-textcleaner.R suite unchanged.

Exported (not just internal) because inst/Shiny/'s own module files are sourced into the global environment by Shiny's own app-loading mechanism, not into the package namespace – an unexported function is not reachable from there by its bare name.

Usage

finalize_textcleaner(
  res,
  data,
  type,
  ids,
  reader = readline,
  edit_fn = automated_edit,
  spell_check = res,
  keep_repeats = FALSE
)

Arguments

res

List. The in-progress textcleaner() result, with $spellcheck$correspondence/$automated/$manual already populated

data

Matrix or data frame. The already-spell-checked response data (res$responses$original for type = "fluency", res$data$original for type = "free")

type

Character. "fluency" or "free", matching textcleaner()'s own type

ids

Character vector. Participant IDs (row.names(data) for type = "fluency", unique(data[, "ID"]) for type = "free")

reader

Function. Passed through to correct_changes(). Defaults to readline

edit_fn

Function. The automated-corrections review function. Defaults to automated_edit()

spell_check

List. The error-path fallback return value, matching textcleaner()'s own original (pre-extraction) behavior exactly. Defaults to res

keep_repeats

Boolean. Should repeated responses (perseverations) be kept in the cleaned responses? Only applies to type = "fluency". Defaults to FALSE, which removes repeats from $responses$clean; they are counted in $behavioral$Perseverations either way

Value

A finished, textcleaner-classed result

Author(s)

Alexander Christensen <alexpaulchristensen@gmail.com>


SemNetCleaner documentation built on Oct. 16, 2026, 5:07 p.m.