Fix Full Table eligibility — accept ordinary verbs, reject orto
The eligibility filter required every form's regularity tag to equal "regular", but the data uses four labels: - regular (179 forms — curated paradigm verbs) - ordinary (50,992 forms — pattern-following verbs like hablar, comer) - irregular (8,653) - orto (176 — orthographic spelling changes like busqué) Result was a 27-combo eligible pool, ~26 of which were -ir verbs in present tense — every Full Table prompt landed on the same handful of verbs. Pulled the rule into a SharedModels function (FullTableEligibility) so it's testable in isolation. Accepts "regular" + "ordinary" (both mean "follows the pattern"); rejects "irregular" and "orto". 9 unit tests cover the matrix including edge cases (incomplete forms, mixed labels, unknown values). PracticeSessionService.makePromptIfFullyRegular now delegates to FullTableEligibility, sorting forms by personIndex so the regularity array lines up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import Foundation
|
||||
|
||||
/// Decides whether a (verb, tense) combo is eligible for the Full Table
|
||||
/// practice mode. Pulled out of `PracticeSessionService` so the rule can be
|
||||
/// unit tested in isolation.
|
||||
public enum FullTableEligibility {
|
||||
|
||||
/// `VerbForm.regularity` values understood by the data set.
|
||||
public enum Regularity: String, Sendable {
|
||||
case regular // paradigm-teaching verbs (small curated set)
|
||||
case ordinary // pattern-following verbs (the bulk of the dataset)
|
||||
case irregular
|
||||
case orto // orthographic spelling change (e.g. busqué)
|
||||
}
|
||||
|
||||
/// Returns true when the given (verb, tense) combo is a candidate for
|
||||
/// Full Table — i.e. it follows the regular pattern with no irregularity
|
||||
/// and no orthographic spelling change.
|
||||
///
|
||||
/// The conjugation must be present in all 6 person slots; missing forms
|
||||
/// disqualify the combo.
|
||||
///
|
||||
/// Accepted: `regular` (paradigm-teaching verbs) and `ordinary`
|
||||
/// (pattern-following verbs — `hablar`, `comer`, `vivir`, etc.).
|
||||
/// Rejected: `irregular` and `orto` (orthographic spelling changes).
|
||||
public static func isFullyRegular(regularities: [String]) -> Bool {
|
||||
guard regularities.count == 6 else { return false }
|
||||
let acceptable: Set<String> = ["regular", "ordinary"]
|
||||
return regularities.allSatisfy { acceptable.contains($0) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user