pyaota.generator.questionset module¶
Question set management for pyaota
- class pyaota.generator.questionset.QuestionSet(question_banks=[])[source]¶
Bases:
objectClass to manage a set of questions loaded from YAML files. Supports loading from multiple files, organizing by topic, and selecting random subsets of questions.
- copy_images_to(dest_dir)[source]¶
Copy all question bank images into dest_dir/images/.
Only copies if any question bank had an
images/directory next to its YAML file.
- get_random_selection(num_questions, topics_order=None, seed=0, rng=None, shuffle=True, shuffle_choices=True, balance_difficulty=False)[source]¶
Selects a random set of questions from the question set.
- Parameters:
num_questions (
int) – Total number of questions to select.topics_order (
list[str] |None) – List of topics in the order to select questions from. If None, use all topics in arbitrary order.seed (
int) – Seed for the random number generator.rng (
callable) – Random number generator instance (e.g., random.Random).shuffle (
bool) – If True, shuffle the selected questions before returning.shuffle_choices (
bool) – If True, shuffle the choices within each multiple-choice question.balance_difficulty (
bool) – If True, select questions proportionally across difficulty levels (1–5). Questions without adifficultyattribute are treated as difficulty 1. The target counts are proportional to the representation of each difficulty level in the available pool.
- Returns:
List of selected question dictionaries.
- Return type: