ai_member_xiaoyan/scripts/fix_distributions.py

81 lines
5.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""Fix answer distributions for all P4 rewrite sets"""
import ast, sys
# The rewrite script as a string - we'll patch specific answer values and option orders
FIXES = {}
# For each QSID block, define: (qs_index, new_answer_index, new_options_list)
# Options list: if provided, replace the options to shift the correct answer to target position
# 021301 first: Q1:A, Q2:A, Q3:B, Q4:B, Q5:A → fix to A=2,B=2,C=1
# Change Q2 from 0→2 (move "He does his own stunts" to C), Q4 from 1→2 (move answer to C)
FIXES["021301_first"] = {
1: {"answer": 2, "options": ["He has a fake beard", "He looks different at home", "He does his own stunts"],
"explanation": "Ben说'He does his own stunts. He is a real professional.'说明这位演员自己做特技动作。选项C为正确答案。"},
3: {"answer": 2, "options": ["He is kind and helpful", "He looks different at home", "He was brave like a hero"],
"explanation": "Lucy说'My neighbour did something brave last week. He was like a hero.'她的邻居做了勇敢的事像英雄一样。选项C为正确答案。"},
}
# 021401 first: Q1:A, Q2:C, Q3:B, Q4:B, Q5:B → fix B=3 → move Q4 to C
FIXES["021401_first"] = {
3: {"answer": 2, "options": ["Buy a new backpack for hiking", "Read the newspaper at home", "Fix the garden seat"],
"explanation": "Ben说'I'm going to repair the garden seat.'他打算修理花园椅子。选项C为正确答案。"},
}
# 021401 second: Q1:C, Q2:C, Q3:C, Q4:C, Q5:B → fix C=4 → spread out
FIXES["021401_second"] = {
0: {"answer": 0, "options": ["Ben's plan to prepare for next week's trip", "Skylar's plan to fix the backpack", "Lucy's plan to read in the park"],
"explanation": "Ben说'I had to plan my trip for next week.'他的计划是为下周旅行做准备。选项A为正确答案。"},
1: {"answer": 0, "options": ["Repair a broken seat", "Buy a new backpack for school", "Plan a weekend visit"],
"explanation": "Lucy说'I should repair this seat.'她需要修椅子。选项A为正确答案。"},
3: {"answer": 1, "options": ["He can't read the newspaper without glasses", "He forgot his backpack with the map", "His newspaper got wet on the seat"],
"explanation": "Ben说'My plan failed because I forgot my backpack with the map.'他忘了带装地图的背包。选项B为正确答案。"},
}
# 021501 first: Q1:B, Q2:B, Q3:B, Q4:A, Q5:A → fix B=3 → move Q2 to C
FIXES["021501_first"] = {
1: {"answer": 2, "options": ["He wants to invite his cousin", "He feels sorry about the party", "He can't invite any more because the house is full"],
"explanation": "Ben说'I'm sorry, but we can't invite any more guests. The house is full.'房子满了无法邀请更多客人。选项C为正确答案。"},
2: {"answer": 0, "options": ["Smith's guest changed from serious to friendly", "Lucy's guest told clever stories", "Ben's guest was serious and quiet"],
"explanation": "问题问的是谁的客人从严肃变友好对话中Smith说'The visitor seemed very serious at first, but later he was very friendly.'是Smith的客人性格变化选项A为正确答案。"},
}
# 021501 second: Q1:A, Q2:B, Q3:B, Q4:B, Q5:A → fix B=3 → move Q3 to A, Q4 to C
FIXES["021501_second"] = {
2: {"answer": 0, "options": ["Write a story because he loves reading", "Work with new technology", "Read instructions more carefully"],
"explanation": "Ben说'I want to write a story. The reason is I love reading.'他计划写故事。选项A为正确答案。"},
3: {"answer": 2, "options": ["Always read the instruction before starting", "Be careful with new technology", "If you copy someone's work, you won't learn"],
"explanation": "Lucy说'If you copy someone's work, you won't learn.'抄袭不能帮助学习。选项C为正确答案。"},
}
# 021701 first: Q1:A, Q2:B, Q3:B, Q4:A, Q5:B → fix B=3 → move Q3 to C
FIXES["021701_first"] = {
2: {"answer": 2, "options": ["A clever machine that can draw", "A basketball game on TV", "A great invention from many years ago"],
"explanation": "Ben说'I read about a great invention in a book. Someone made it many years ago.'他读到一项古老发明。选项C为正确答案。"},
}
# 021801 first: Q1:A, Q2:A, Q3:B, Q4:B, Q5:B → fix B=3 → move Q5 to C
FIXES["021801_first"] = {
4: {"answer": 2, "options": ["He lost his keys in the kitchen", "He was late for a film at the theatre", "His watch stopped because the battery was old"],
"explanation": "Ben说'My watch stopped because the battery was old. I bought a new one after lunch.'他的手表没电了。选项C为正确答案。"},
}
# 022101 first: Q1:A, Q2:A, Q3:B, Q4:B, Q5:A → fix A=3 → move Q2 to C
FIXES["022101_first"] = {
1: {"answer": 2, "options": ["At the port, from boats", "Near the factory", "At home, a ball hit the window"],
"explanation": "Lucy说'I heard a loud noise when a ball hit the window.'球撞到窗户发出了噪音这发生在家里。选项C为正确答案。"},
}
# 032501 first: Q1:A, Q2:A, Q3:B, Q4:A, Q5:B → fix A=3 → move Q1 to C
FIXES["032501_first"] = {
0: {"answer": 2, "options": ["Skylar's job online", "Lucy's job at a big company", "Ben's job as a journalist with a partner"],
"explanation": "Ben说'My partner and I write stories for a newspaper.'他和搭档一起写新闻。选项C为正确答案。"},
}
# Summary of all fixes to print
for qsid, fixes in FIXES.items():
print(f"QSID: {qsid}")
for idx, fix in fixes.items():
print(f" Q{idx}: answer→{fix['answer']}, options={fix['options']}")