Lazy text capitalization with low latency large language models (blog.florianschulz.info)

🤖 AI Summary
A designer built a lightweight web prototype that “lazy-capitalizes” lines of text as you hit Enter, using Google’s Gemini models (gemini-2.5-flash-lite for speed, with flash/pro variants trading latency for accuracy). The app sends the current line to the Gemini API with a simple system instruction (“You’re a spell-checker… Return the text with correct capitalization. Primary languages: German, English.”) and requests structured JSON responses. The result: near-local latency in the browser, line-by-line replacements (with caret/selection handling), auto-prepending dashes for list-like input, name emphasis (wrapping names in underscores), and automatic apostrophe fixes. The author also used Claude to generate UI code and refined the system prompt to emphasize punctuation preservation and not adding content. This experiment highlights a practical pattern for low-friction text editing: small, cheap LLMs can provide fast, context-limited post-processing (capitalization, punctuation, lightweight normalization) that feels immediate on mobile or in-browser. Key trade-offs: latency vs. accuracy across model tiers, consistency issues with typographic characters (smart quotes/apostrophes) that may require deterministic post-processing like TypographizerJS, and privacy/architecture choices (API vs. local WebLLM/Gemini Nano). The approach opens up line-by-line affordances beyond capitalization—auto-formatting, parsing to-dos, inline translation or fact-checking—while remaining implementable with modest prompts, JSON responses, and small integration glue.
Loading comments...
loading comments...