Smart Parse Saved My Sanity, AI Parse Saved My Weekend
How PK-Swift evolved from strict CSV input to dual parsing modes, and what non-developers should copy from that workflow.
Series: PK·SWIFT B.LOG
- 1. Smart Parse Saved My Sanity, AI Parse Saved My Weekend ← you are here
- 2. Global UX Is 200 Tiny Fixes: The Day I Removed Two Korean Words
- 3. SEO, AdSense, and Coffee Buttons Without Looking Desperate
- 4. Buy Me a Coffee Setup Playbook for Solo Builders

I used to think users would give me clean CSV files.
That thought lasted about 12 hours.
Real inputs were a mix of Excel paste, natural language notes, weird separators, and "I copied this from a PDF and hope for the best." So PK-Swift moved to a dual parser model:
- Smart Parse: offline, rule-based, instant
- AI Parse: Gemini-based rescue mode for messy data
The turning-point commit was f1ab0e9 (2026-02-09), where parsing became a first-class feature instead of an afterthought.
What changed in code
This was the structural change that mattered:
// Rule-based parser that runs locally
function universalParse(text, opts = {}) {
const jsonResult = tryParseJSON(text, opts);
if (jsonResult) return jsonResult;
const tabResult = localParseFreeform(text, opts);
if (tabResult) return tabResult;
const nlResult = tryParseNaturalLanguage(text);
if (nlResult) return nlResult;
throw new Error('Could not parse input.');
}
And AI mode used explicit config, not vibes:
body: JSON.stringify({
contents: [{ parts: [{ text: prompt }] }],
generationConfig: { temperature: 0.1, maxOutputTokens: 32768 }
})
d289ef9 moved model endpoint to gemini-2.5-flash, and f66764b increased output token limit from 4096 to 32768.
Why this mattered for real users
Rule-based parsing handled most clean and semi-clean cases fast, with no API key required.
AI parsing handled the "this data is cursed" scenario, where structure exists but not in any predictable format.
That split reduced frustration because users were not blocked by one strict pathway.
Also: giving users a fallback path is product empathy in disguise.
Practical Tips for Non-Developers
- Always build a fast local path first. "Works offline" is a trust signal and a cost shield.
- Add AI as fallback, not foundation. If API quota dies, your app should still function.
- Keep parser errors human-readable. "Line 4: invalid number" beats generic failure by miles.
- Save API keys locally with clear disclosure. Security theater destroys trust.
- Treat input diversity as a product requirement, not user error.
Tiny joke, big truth
I learned that users do not "enter data." They launch data at your app like confetti.
If your parser survives confetti, you can probably ship.