Mindmentor_offline_app / scripts /enhance_bigfive_json.py
jan01's picture
Upload enhance_bigfive_json.py
fb6d339 verified
raw
history blame contribute delete
659 Bytes
import json
with open("data/bigfive_questions_real.json", "r", encoding="utf-8") as f:
data = json.load(f)
enhanced_data = []
for item in data:
reverse = "(R)" in item["question"]
clean_question = item["question"].replace("(R)", "").strip()
enhanced_data.append({
"id": item["id"],
"trait": item["trait"],
"question": clean_question,
"reverse": reverse
})
# Save to new file
with open("data/bigfive_questions_cleaned.json", "w", encoding="utf-8") as f:
json.dump(enhanced_data, f, indent=2, ensure_ascii=False)
print("✅ Cleaned and saved to bigfive_questions_cleaned.json")