| author | Alan Dipert
<alan@dipert.org> 2025-12-04 04:11:47 UTC |
| committer | Alan Dipert
<alan@dipert.org> 2025-12-04 04:11:47 UTC |
| parent | 3fe4dbf877f3a65d1c0682dc49a5012b35d42122 |
| test_generator.py | +13 | -10 |
diff --git a/test_generator.py b/test_generator.py index 0f220bb..a11dae6 100644 --- a/test_generator.py +++ b/test_generator.py @@ -440,8 +440,7 @@ def _planned_features( remaining: Dict[str, int], idx: int, ) -> SentenceFeatures: - """Greedy planner to satisfy coverage quotas deterministically.""" - # cycles for variation + """Greedy planner to satisfy coverage quotas deterministically with overlap.""" subj_pool = [ np_features("man", AGENT, plural=False, adjectives=["tall"]), np_features("woman", AGENT, plural=False, adjectives=["tall"]), @@ -466,31 +465,35 @@ def _planned_features( tense = "PRES" use_irregular_verb = True - # Priority: irregular verb, irregular noun, ditransitive, fem plural, plural, adjective + # 1) Irregular verb coverage (monotransitive chase past) if remaining.get("irregular_verb", 0) > 0: verb_id = "chase" tense = "PAST" use_irregular_verb = True remaining["irregular_verb"] -= 1 - elif remaining.get("irregular_noun", 0) > 0: - obj1 = np_features("boy", RECIPIENT, plural=True, adjectives=["red"], use_irregular=True) - remaining["irregular_noun"] -= 1 - elif remaining.get("ditransitive", 0) > 0: + + # 2) Ditransitive coverage (can overlap with irregular noun) + if verb_id != "chase" and remaining.get("ditransitive", 0) > 0: verb_id = "give" obj2 = theme_pool[idx % len(theme_pool)] remaining["ditransitive"] -= 1 - # fem plural receiver + # 3) Irregular noun coverage (can overlap with ditransitive) + if remaining.get("irregular_noun", 0) > 0: + obj1 = np_features("boy", RECIPIENT, plural=True, adjectives=["red"], use_irregular=True) + remaining["irregular_noun"] -= 1 + + # 4) fem plural receiver (if applicable) if remaining.get("fem_plural", 0) > 0 and obj1.noun_id in {"woman", "girl"}: obj1 = np_features(obj1.noun_id, RECIPIENT, feminine=True, plural=True, adjectives=obj1.adjectives) remaining["fem_plural"] -= 1 - # enforce plural coverage + # 5) plural coverage (if still needed) if remaining.get("plural", 0) > 0 and not (obj1.plural or subj.plural or (obj2 and obj2.plural)): obj1 = np_features(obj1.noun_id, obj1.role, feminine=obj1.feminine, plural=True, adjectives=obj1.adjectives) remaining["plural"] -= 1 - # enforce adjective coverage + # 6) adjective coverage if remaining.get("adjective", 0) > 0: if not obj1.adjectives: obj1 = np_features(obj1.noun_id, obj1.role, feminine=obj1.feminine, plural=obj1.plural, adjectives=["red"])