Generate themes via multi-pass clustering + label-after-clustering
Source:R/theme_algorithm_v2.R
generate_themes_multipass.RdThe v2 theme algorithm. Multi-pass partitioning: at each pass the AI sees the current leaves (codes initially, then prior-pass clusters) and either proposes a partition into clusters OR declares convergence. The penultimate stable structure becomes subthemes; the final stable structure becomes themes. A dedicated post-convergence labeling pass assigns researcher-facing names + descriptions to every theme and subtheme with the full tree visible.
Usage
generate_themes_multipass(
coding_state,
provider,
config = list(),
learning_context = NULL,
research_focus = "",
concepts = NULL,
audit_log = NULL,
response_cache = NULL,
live_tracker = NULL,
methodology_override = NULL
)Arguments
- coding_state
ProgressiveCodingState- provider
AIProvider- config
Theme config section (only
algorithm+quotes_per_themeare consulted; the v2 path has NO threshold knobs per C1).- learning_context
Optional
LearningContext; if present, itsfor_themingtext is added to the clustering prompts as reference context. Used by the manuscript-learning path.- research_focus
Character; the study's research focus statement.
- concepts
Optional character vector of core research concepts.
- audit_log
Optional
AuditLog.- response_cache
Optional
ResponseCache.- live_tracker
Optional
LiveTracker(per C3).- methodology_override
Optional character; per-call methodology rules override. Used by the Mode 3 inductive emergent-themes pass.
Details
Called by generate_themes_iterative() when
config$analysis$themes$algorithm == "v2" (the default).