Complete this code. I want a single txt file for each trajectory. Merge the content of…
- User
Complete this code. I want a single txt file for each trajectory. Merge the content of GPT and Mistral so that the final txt file doen't repeat the same text twice.
"""
import pandas as pd import numpy as np
def load_data(model: str): """ Load the taxonomy data filter columns by theme rename columns: f"{theme}_coverage", f"{theme}_trajectory" -> "coverage", "trajectory" """ df = pd.read_pickle(f"/home/esther/PycharmProjects/religious-paths/data/results/{model}/predefined_taxonomy_results_2025-08-20_with_text.pickle") df = df[[f'belief_traj', f"belief_text", f'practice_traj', f"practice_text",]]
# for the trajectory column, convert the tuples to their mean values: (0.1, 0.2) -> 0.15 df['belief_traj'] = df['belief_traj'].apply( lambda example: np.column_stack((example[:, 0], [sum(i) / 2 for i in example[:, 1]])) ) df['practice_traj'] = df['practice_traj'].apply( lambda example: np.column_stack((example[:, 0], [sum(i) / 2 for i in example[:, 1]])) ) return dfif name == 'main': """ Here: --- We selected oscillating practice testimonies for close reading: ids = [19795, 19807, 20014, 20083, 20158, 20292, 20367, 20405, 20505, 20604, 20978, 21004, 21013, 21180, 21259, 21372, 21437, 21550, 21654, 21783, 21817, 21978, 22198, 22469, 22598]
""" all_gpt_data = load_data("gpt") all_mistral_data = load_data("mistral")ids = [19795, 19807, 20014, 20083, 20158, 20292, 20367, 20405, 20505, 20604, 20978, 21004, 21013, 21180, 21259, 21372, 21437, 21550, 21654, 21783, 21817, 21978, 22198, 22469, 22598] pass for i in ids: row_gpt = all_gpt_data.loc[i] row_mistral = all_mistral_data.loc[i] # create a text file containing the positions and text with open(f"trajectories2read/{i}.txt", "w") as f: # write the structure # f.write(f"Structure: {row[f'{theme}_structure']}\n\n") for i, row2 in df_row.iterrows(): f.write(f"Position: {round(row2['position'], 2)}\n") f.write(f"{row2['general_text']}\n\n")"""
- Assistant
- User
I want the belief and practice trajectories to be mixed. Meaning, list the segments in the order (position)
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.