ecc-regex-vs-llm-structured-text

Parse structured text with deterministic regex and route unresolved records to authorized validators.

Updated Apr 18, 2025
One-click install
npx skills add https://github.com/adriancodes/dotfiles --skill ecc-regex-vs-llm-structured-text-adriancodes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ecc-regex-vs-llm-structured-text
Source: https://github.com/adriancodes/dotfiles/tree/main/dot_agents/skills/ecc-regex-vs-llm-structured-text
Command: npx skills add https://github.com/adriancodes/dotfiles --skill ecc-regex-vs-llm-structured-text-adriancodes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing between regex and LLM-based parsing for structured text is often done by guesswork, leading to silent data loss, unaccounted malformed records, and unjustified model costs. This Skill provides a decision framework and a complete parser pattern that accounts for every input record. ## Core Features & Use Cases - Decision Framework: A five-step process for choosing deterministic parsing versus model assistance based on grammar stability and measured accuracy against a labeled corpus. - Complete Parser Pattern: A Python reference implementation using dataclasses and regex that reports unmatched spans, duplicate IDs, and malformed records instead of dropping them. - Validator Boundary: A contract for optionally passing only problematic spans to an explicitly authorized model validator with schema checks, source-grounding verification, and cost caps. - Use Case: When converting a corpus of numbered quiz questions with A-D answers into structured records, use the deterministic parser first, then route only unresolved records to review or an approved validator while reporting exact-match accuracy and unresolved rates. ## Quick Start Ask the assistant to apply the regex versus LLM decision framework to parse your structured text file and report all unresolved records with reasons.

Frequently Asked Questions about ecc-regex-vs-llm-structured-text

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
When should I use regex instead of an LLM for parsing text?▼

Use regex or an ordinary parser when the text follows a stable, consistent grammar such as numbered records with labeled fields. Reserve model assistance for explicitly authorized low-confidence cases the grammar cannot handle, and measure both approaches against a representative labeled sample.

How do I parse structured text without losing malformed records?▼

Split the input into record blocks, attempt a full grammar match on each block, and collect non-matching blocks into an unresolved list with reasons. This ensures malformed, duplicate, or unmatched records are reported rather than silently dropped before confidence scoring.

How do I validate LLM output against a parsing schema?▼

Require an explicit structured result and validate it with a schema check covering field names, types, choice counts, and allowed answer values. Compare the candidate against the source span, since syntactically correct JSON does not establish factual correctness.

What are the limitations of regex-based text parsing?▼

A narrow grammar cannot handle multiline content, OCR noise, malformed encodings, or free-form input without corpus-specific extensions. These cases need a richer parser, human review, or an authorized model adapter rather than forcing the regex to match.

What metrics should I report for a text extraction pipeline?▼

Report exact-match accuracy, field accuracy, unmatched-record rate, unresolved rate, and validator cost against the caller's labeled corpus. Record denominators and dataset versions, and avoid repeating anecdotal coverage or cost-savings figures as expected results.