Skip to contents

All functions

aggregate_simulations()
Aggregate simulation runs
combine_book_files()
Combine chapter text files into one numbered file per book
combine_split_chapter_files()
Combine split chapter chunk files
compute_run_ai_metrics()
Compute derived pre/post effect metrics from raw turn-level output
compute_run_ai_metrics_cumulative()
Compute cumulative chapter metrics against the original baseline
compute_run_ai_metrics_one_turn()
Compute one-turn ingroup/outgroup metrics from raw output
evaluate_text_analysis()
Evaluate text-analysis outputs against reference labels
extract_pdf_text_with_llm()
Extract text from a PDF with a multimodal LLM
fix_text_file()
Fix text file encoding and normalize punctuation/whitespace
interpolate_spotify_audiobook_duration()
Interpolate Spotify audiobook duration from text size
list_book_chapters()
List book chapter files inside a books directory
make_annotation_prompt()
Build a numeric-response prompt for text analysis
make_baseline_prompt()
Build the baseline (Turn 1) prompt
make_post_prompt()
Build the post-intervention (Turn 2) prompt
make_treatment_prompt() build_simulate_treatment_prompt()
Build a concrete prompt for simulate_treatment()
model_agreement()
Compute inter-model agreement
model_agreement_sensitivity()
Summarize model agreement across analysis levels
model_pairwise_cor()
Pairwise model correlations
model_rank_consistency()
Compare model-derived rankings
nalanda()
A Random Historical Fact About Nalanda University
pairwise_for_level()
Pairwise model correlations at a chosen analysis level
plot_chapter_scores_faceted()
Faceted plot of chapter scores
plot_chapter_trajectories()
Plot chapter trajectories by book
plot_chapters_over_time()
Plot chapters over time (multi-timepoint means)
plot_chapters_over_time_one_turn()
Plot chapter trajectories for one-turn simulations
plot_forest_books()
Create a forest plot of book-level polarization reduction effects
plot_model_agreement()
Plot inter-model agreement
plot_top_unit_heatmap()
Plot model-by-unit rank heatmap
plot_top_unit_pairs()
Plot paired subgroup ranks for top units
plot_top_units()
Plot units that rank consistently high across models
prepare_forest_books()
Prepare book-level data for forest plotting
rank_weighted()
Rank rows using a weighted rubric
read_book_texts()
Read book chapters into a nested list
rename_chapters()
Rename chapter text files in a folder to a sequential order
renumber_chapters_across_folders()
Renumber chapter files across ordered folders
run_ai_cumulative_chapters()
Run AI model on books with cumulative chapter context
run_ai_on_chapters()
Run AI model on book chapters and collect structured responses
run_ai_on_chapters_one_turn()
Run AI model on book chapters with a single prompt per simulation
run_text_analysis()
Run row-wise text analysis with a prompt template
save_forest_plot()
Save a forest plot to PNG and PDF formats
simulate_treatment()
Simulate a generic multi-turn treatment workflow
split_book_section_by_headings()
Split a book section into chapter files using known headings
summarize_chapter_scores()
Summarize simulated chapter scores
summarize_identity_adherence()
Summarize whether the model adopts the requested identity
summarize_identity_match_rates()
Summarize identity match rates by model
summarize_model_correlations()
Summarize pairwise model correlations
summarize_simulation_stability()
Summarize simulation stability across chapters
summarize_top_units()
Summarize units that rank consistently high across models
summarize_treatment_results()
Summarize generic treatment results
toy_run_ai_turns
Toy raw turn-level AI simulation output
toy_sim_results
Toy simulated chapter results