Typo Correction
IntentCSS automatically fixes common spelling mistakes so prompts remain usable even when input is imperfect.
Overview
Humans make typing mistakes.
IntentCSS includes a typo correction layer that runs before prompt parsing and intent matching.
This allows prompts like:
purpl buton
purpl buton
to be understood as:
purple button
purple button
without requiring the user to rewrite the command.
Why Typo Correction Exists
Without typo correction, a small spelling mistake could completely prevent IntentCSS from understanding a prompt.
For example:
intentcss generate --prompt "gren buton"
intentcss generate --prompt "gren buton"
Without correction:
Unknown prompt
Unknown prompt
With correction:
green button
green button
Generated output:
rounded-lg bg-green-600 px-4 py-2 text-white hover:bg-green-700
rounded-lg bg-green-600 px-4 py-2 text-white hover:bg-green-700
Correction Flow
The typo correction stage runs before parsing.
User Prompt
↓
Typo Correction
↓
Prompt Parsing
↓
Intent Matching
↓
Generation
User Prompt
↓
Typo Correction
↓
Prompt Parsing
↓
Intent Matching
↓
Generation
Example:
purpl buton
purpl buton
becomes:
purple button
purple button
before the parser sees the prompt.
Supported Corrections
IntentCSS currently focuses on correcting words that directly affect generation.
Components
buton → button
btnn → button
navbr → navbar
sidbar → sidebar
frm → form
buton → button
btnn → button
navbr → navbar
sidbar → sidebar
frm → form
Colors
blu → blue
gren → green
purpl → purple
yelow → yellow
blu → blue
gren → green
purpl → purple
yelow → yellow
Behaviors
responive → responsive
centeerd → centered
adaptve → adaptive
responive → responsive
centeerd → centered
adaptve → adaptive
Example
Input:
intentcss generate --prompt "purpl buton"
intentcss generate --prompt "purpl buton"
Internal correction:
purple button
purple button
Output:
rounded-lg bg-purple-600 px-4 py-2 text-white hover:bg-purple-700
rounded-lg bg-purple-600 px-4 py-2 text-white hover:bg-purple-700
Visible Corrections
When a correction occurs, IntentCSS can display the corrected prompt.
Example:
IntentCSS
Corrected: purple button
Prompt: purpl buton
rounded-lg bg-purple-600 px-4 py-2 text-white hover:bg-purple-700
IntentCSS
Corrected: purple button
Prompt: purpl buton
rounded-lg bg-purple-600 px-4 py-2 text-white hover:bg-purple-700
This helps users understand what IntentCSS interpreted.
How Matching Works
IntentCSS compares words against known vocabulary.
When a word is similar enough to a known term, the correction system replaces it with the closest match.
Example:
gren
gren
matches:
green
green
because it is the closest known color.
Likewise:
buton
buton
matches:
button
button
because it is the closest supported component.
Benefits
Typo correction improves:
- User experience
- Prompt reliability
- Confidence scoring
- Intent detection
It allows users to type naturally without needing perfect spelling.
Limitations
IntentCSS does not attempt to understand completely unrelated words.
Example:
intentcss generate --prompt "glorp wazzoo"
intentcss generate --prompt "glorp wazzoo"
Output:
Could not confidently understand that prompt.
Try words like: button, card, navbar, blue, responsive.
Could not confidently understand that prompt.
Try words like: button, card, navbar, blue, responsive.
The typo system is designed to correct likely mistakes, not invent meaning.
Next Steps
Continue with:
- Confidence Scoring
- Intent Engine
- Supported Intents
- Modifiers