Companion film
Bad text stays visible
Change a valid invoice reference to malformed text and watch the raw input stay visible while an anchored parse guard returns unparsed and closes the decision as rejected.
44 secGrid 0.63.2
Open film page →Canonical Grid model
Portable model for classification, text cleanup, and defensive parsing.
What this model gives you
10 min to study · Source reviewed 2026-08-25
Continue with guided practiceExpected checkpoint
After loading the canonical invoice and owner text.
Regex validates the complete shape while a glob checks the expected suffix.
The year becomes a stable field and owner data is rewritten without changing the raw source.
TRY and DEFAULT keep downstream classification readable.
MODEL "Text And Quality"
DESCRIPTION "Portable model for classification, text cleanup, and defensive parsing."
VERSION "1.0.0"
AUTHOR "Grid Team"
TAGS "canonical", "portable", "text", "quality"
# Raw text inputs
A1 = "INV-2026-001"
A2 = "priority:urgent owner:ops"
A3 = raw"^INV-\d+-\d+$"
# Parsing and cleanup
A4 = REGEXMATCH(A1, A3)
A5 = REGEXEXTRACT(A1, /INV-(\d+)/)
A6 = REGEXREPLACE(A2, /owner:\w+/, "owner:shared")
A7 = WILDCARDMATCH(A1, glob"INV-*-001")
# Classifications
B1 = A4 AND A7 THEN :accepted ELSE :rejected
B2 = MATCH(A5, "2025" -> "legacy", "2026" -> "current", _ -> "other")
B3 = TRY 10 / 0 ELSE 0
B4 = BLANK DEFAULT "unassigned"
B5 = `invoice={A1} year={A5} state={B1}`
END MODEL