Spaces:
Runtime error
Runtime error
Commit History
-
feat(reading): add cloze (fill-in-the-blank) as a second exercise type (#5)
Arthur_DiazUnverified signature## What & why Adds fill-in-the-blank (cloze) exercises alongside comprehension questions, selectable per generation. The verified text is shared between activity types (generated once, cached), so a cloze on an already-seen text costs only the cloze call. Blanks are chosen pedagogically by the LLM — verbs, prepositions, connectors, collocations, the levers of real mastery — with plausible distractors of the same kind. ## Robustness The LLM is not trusted for indexing. `locate_blanks` validates every proposed answer as a verbatim whole-word match against the text, computes the character offset Python-side, consumes repeated words at distinct positions, and drops anything not found — the cloze analogue of the ONNX fp32 faithfulness gate. One malformed-JSON retry, then a clear error. Free-text scoring is case/accent tolerant ("Café " matches "cafe"). ## UX - Cloze hides the intact text (it would reveal every answer) and shows only the gapped version; comprehension-questions mode still s…8a8cb44