Solutions · Text Generation · Grammar & spell correction

Polish text in real time, on the device.

The TextCorrection engine fixes grammar, spelling, subject-verb agreement, tense errors, and stylistic inconsistencies in any language the underlying model supports. Sync and async APIs, streaming completion events for live editing UIs, and zero cloud calls so user keystrokes never leave the machine.

Real-time async Streaming events Multilingual

Correct(text)

Synchronous correction returning the cleaned string.

CorrectAsync(text, ct)

Async with cancellation for typing-aware UIs.

AfterTextCompletion

Event with each generated chunk for streaming display.

What it fixes

From typos to tense agreement.

TextCorrection is a generative corrector, not a rule engine. It catches mistakes that simple spellcheckers miss because it understands context: homophones, agreement, subordinate clauses, register, ambiguous pronouns. The output is the corrected text, not a list of suggestions, so you ship clean strings to the user instead of a dialog tree.

Spelling and typos

Catches misspellings even when they form valid words ("there/their/they're", "your/you're"). Context-aware, not dictionary-only.

Subject-verb agreement

"The list of items are long" becomes "The list of items is long". Resolves agreement across long subordinate clauses that confuse rule engines.

Tense consistency

Aligns verb tenses across compound sentences. "He went to the store and buys milk" becomes "He went to the store and bought milk".

Punctuation and casing

Restores missing periods, commas, capital letters, and apostrophes. Handles dictation outputs that arrive without proper formatting.

Word order

Reorders awkward phrasings produced by non-native speakers, dictation systems, or machine translation post-editing.

Multilingual

Works in every language supported by the underlying model. Same API, same call, automatic language detection from input.

Code samples

Three integration shapes.

SyncCorrection.cs
using LMKit.Model;
using LMKit.TextEnhancement;

var model = LM.LoadFromModelID("qwen3.5:4b");
var corrector = new TextCorrection(model);

string input = "My cat dont never flyed to the moon because he too tired.";
string corrected = corrector.Correct(input);

Console.WriteLine(corrected);
// "My cat has never flown to the moon because he was too tired."
Applications

Where local correction matters.

Email and messaging clients

Catch mistakes before send without uploading every draft to a cloud service. Critical for HIPAA and GDPR-bound communications.

Dictation post-processing

Pair with SpeechToText to clean up raw transcripts: punctuation, capitalisation, agreement.

Translation post-editing

Run after TextTranslation to smooth out machine-translated artefacts before publishing.

Forms and field validation

Auto-correct user-entered free-text fields before they reach the backend. Reduces downstream parsing errors.

Customer support drafting

Polish reply drafts without sending customer data to third-party grammar tools. Keep PII inside the perimeter.

Authoring tools

Embed correction directly in writing apps, IDEs, and CMS editors. Real-time suggestions without a cloud round-trip.

Developer Resources

API reference.

TextCorrection

Sealed class. Construct with an LM, call Correct / CorrectAsync, optionally subscribe to AfterTextCompletion for streaming.

View documentation

AfterTextCompletion

Event raised on each token chunk during async correction. Use to drive live UI updates and progress indicators.

View documentation

TextRewriter

Companion class for stylistic transformation. Use after TextCorrection to also adjust tone, formality, or voice.

Text Enhancement page

Demos & docs

Build it. Read it. Try it.

Working console demos on GitHub, step-by-step how-to guides on the docs site, and the API reference for the classes used on this page.

Ship clean text. Keep typing private.

Get Community Edition Download