Skip to content

Commit 9c97301

Browse files
committed
Stricter scoring for Lipogram/Univocalic: lenient for 1-2, binary after
- 0 violations: 1.0 - 1 violation: 0.5 - 2 violations: 0.25 - 3+ violations: 0.05 (near zero)
1 parent 8d6a79c commit 9c97301

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/abide/forms/constrained.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,14 @@ def verify(self, poem: str | PoemStructure) -> VerificationResult:
160160

161161
if total_letters == 0:
162162
lipogram_score = 0.0
163+
elif forbidden_count == 0:
164+
lipogram_score = 1.0
165+
elif forbidden_count <= 2:
166+
# Lenient for 1-2 mistakes: 1 -> 0.5, 2 -> 0.25
167+
lipogram_score = 0.5**forbidden_count
163168
else:
164-
# Quadratic penalty for stricter GRPO training
165-
linear_lipogram = 1.0 - (forbidden_count / total_letters)
166-
lipogram_score = linear_lipogram**2
169+
# Binary after that - near zero
170+
lipogram_score = 0.05
167171

168172
# Combine scores
169173
score = line_result.score * 0.1 + lipogram_score * 0.9
@@ -238,10 +242,14 @@ def verify(self, poem: str | PoemStructure) -> VerificationResult:
238242

239243
if total_vowels == 0:
240244
univocalic_score = 0.0
245+
elif wrong_vowels == 0:
246+
univocalic_score = 1.0
247+
elif wrong_vowels <= 2:
248+
# Lenient for 1-2 wrong vowels: 1 -> 0.5, 2 -> 0.25
249+
univocalic_score = 0.5**wrong_vowels
241250
else:
242-
# Quadratic penalty for stricter GRPO training
243-
linear_univocalic = correct_vowels / total_vowels
244-
univocalic_score = linear_univocalic**2
251+
# Binary after that - near zero
252+
univocalic_score = 0.05
245253

246254
# Combine scores
247255
score = line_result.score * 0.1 + univocalic_score * 0.9

0 commit comments

Comments
 (0)