Grammar
Find, count, and auto-correct grammar, style, and spelling issues in free text using the open-source LanguageTool engine
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available Β· $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/grammar/index.md to help me query Grammar with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Find spelling and grammar issues in text
Example output Β· captured
- Connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SELECT rule_id, category, message, suggestions
FROM grammar.main.grammar_check('She go to school every day.')
ORDER BY "offset"
| rule_id | category | message | suggestions |
|---|---|---|---|
| HE_VERB_AGR | Grammar | The pronoun 'She' is usually used with a third-person or a past tense verb. | ["goes", "went"] |
Quick start
Choose where to run Grammar, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'grammar' AS grammar (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-grammar:0.5.0'
);
3. Run a query
SELECT rule_id, category, message, suggestions
FROM grammar.main.grammar_check('She go to school every day.')
ORDER BY "offset"
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connectorβs deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'grammar' AS grammar
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT rule_id, category, message, suggestions
FROM grammar.main.grammar_check('She go to school every day.')
ORDER BY "offset"
Query Farm operates Grammar for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use grammar as the catalog alias for the query below.
4. Run a query
SELECT rule_id, category, message, suggestions
FROM grammar.main.grammar_check('She go to school every day.')
ORDER BY "offset"
Technical details
- Verified connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until youβre ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'grammar' AS grammar (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-grammar:0.5.0'
);
Overview
Grammar, style, and spelling checking + auto-correction (LanguageTool)
![]()
Proofread, spell-check, and auto-correct natural-language text directly in DuckDB SQL β grammar checking, style suggestions, typo detection, and one-call rewriting, powered by LanguageTool and served to DuckDB over Apache Arrow.
This VGI worker turns the open-source LanguageTool proofreading engine into a set of SQL functions, so you can clean up and quality-check text without leaving your database or calling an external API. It is built for data engineers, analysts, and anyone running text-heavy pipelines: validating user-generated content, normalizing product descriptions and support tickets, flagging typos in scraped or imported data, scoring writing quality, or batch-correcting columns of free text. Everything runs locally in the worker process β your text is never sent to a third-party service.
Under the hood the worker embeds LanguageTool, the same multilingual grammar and style checker used by millions of writers. Each query runs against a cached JLanguageTool engine that applies LanguageTool's rule set (grammar, punctuation, style, and spelling rules) to your text and returns structured results. The English language pack (en-US, en-GB, en-CA, and other English variants) is shipped in the JAR; every function accepts an optional language argument that defaults to en-US. For implementation details and the rule catalog, see the LanguageTool developer documentation and the LanguageTool source on GitHub.
Key concepts. An issue is a single problem LanguageTool flags β a grammar, punctuation, style, or spelling rule that fired over a span of your text β carrying the rule that matched, a human-readable category and message, the offending span, and an ordered list of suggested replacements (best first). A language is a dialect/locale code (this worker ships the English family: en-US, en-GB, en-CA, ...) that decides which spellings and rules apply; it defaults to en-US.
When to reach for it. Use this worker whenever a SQL pipeline needs to find, quantify, gate on, or repair writing problems in a text column without leaving the database or shipping data to an external proofreading API: validating user-generated content, scoring writing quality, flagging typos in scraped data, or batch-cleaning free-text columns. The functions group into checking (surface or count issues, or test whether text is clean), correction (rewrite text by applying the top suggested fix), and reference (discover the supported language codes).
Catalog
Everything grammar exposes once attached β read straight from the worker's
released build.
main 1 table Β· 4 functions
Grammar, style, and spelling checking and auto-correction functions powered by LanguageTool.
Schema examples (8)
Surface each grammar/spelling issue in a sentence with its rule, category, and suggested fixes.
SELECT rule_id, category, message, suggestions
FROM grammar.main.grammar_check('She go to school every day.')
ORDER BY "offset";
| rule_id | category | message | suggestions |
|---|---|---|---|
| HE_VERB_AGR | Grammar | The pronoun 'She' is usually used with a third-person or a past tense verb. | ["goes", "went"] |
Count the writing issues in a piece of text (default en-US).
SELECT grammar.main.grammar_count('I has two dog.') AS issue_count;
Test whether text is free of writing issues.
SELECT grammar.main.is_grammatical('The quick brown fox jumps.') AS clean;
Auto-correct text by applying the top suggested fix for each issue.
SELECT grammar.main.correct('She go to school evry day.') AS corrected;
4 more examples
List the supported English language codes to pass as the language argument.
SELECT code, name
FROM grammar.main.grammar_languages
WHERE code LIKE 'en-%'
ORDER BY code;
Auto-correct a batch of sentences and re-count the issues left in each rewrite (grammar_count over correct), so rows that one pass of top-suggestion fixes did not fully clean (issues_after > 0) sort first.
SELECT txt AS original, grammar.main.grammar_count(txt) AS issues_before,
grammar.main.correct(txt) AS corrected,
grammar.main.grammar_count(grammar.main.correct(txt)) AS issues_after
FROM (VALUES ('Thanks for you order, it will ship tomorow.'), ('I could of done it better.'), ('This are a test of the the system.'), ('Your package has been delivered.')) AS t(txt)
ORDER BY issues_after DESC, original;
Explain an auto-correction: list each issue grammar_check flags in a sentence with its category, flagged text, and top suggestion (the replacement correct applies) next to the corrected sentence.
SELECT c.category, c.bad_text, c.suggestions[1] AS applied_fix,
grammar.main.correct('Thanks for you order, it will ship tomorow.') AS corrected
FROM grammar.main.grammar_check('Thanks for you order, it will ship tomorow.') AS c
ORDER BY c."offset";
Rewrite only the rows that fail the grammar check: filter a text column with is_grammatical, then show each failing row's issue count (grammar_count) and its auto-corrected text (correct), worst first.
SELECT txt AS original, grammar.main.grammar_count(txt) AS issues,
grammar.main.correct(txt) AS corrected
FROM (VALUES ('Its a nice day, isnt it?'), ('Your package has been delivered.'), ('I could of done it better.')) AS t(txt)
WHERE NOT grammar.main.is_grammatical(txt)
ORDER BY issues DESC, original;
grammar_languages
One row per language code accepted by the grammar functions' language argument, with its human-readable name.
List every supported language code with its human-readable name, alphabetically.
SELECT code, name FROM grammar.main.grammar_languages ORDER BY code;
Filter to the English variants accepted by the language argument.
SELECT code
FROM grammar.main.grammar_languages
WHERE code LIKE 'en-%'
ORDER BY code;
Count how many language codes this worker accepts.
SELECT count(*) AS supported_languages FROM grammar.main.grammar_languages;
3 more examples
SELECT code, name FROM grammar.main.grammar_languages() ORDER BY code;
SELECT code
FROM grammar.main.grammar_languages()
WHERE code LIKE 'en-%'
ORDER BY code;
SELECT count(*) AS supported_languages
FROM grammar.main.grammar_languages();
correct (text VARCHAR, language VARCHAR) +1 overload
Auto-correct text by applying the first LanguageTool suggestion for each issue, using the default language (en-US).
correct(text VARCHAR) β VARCHARcorrect(text VARCHAR, language VARCHAR) β VARCHAR
Auto-correct a sentence in the default language (fixes the agreement error; the 'evry' typo becomes the top suggestion 'very').
SELECT grammar.main.correct('She go to school evry day.');
Auto-correct text in a specific language (fixes verb and noun agreement).
SELECT grammar.main.correct('I has two dog.', 'en-US');
Auto-correct a batch of sentences and re-count the issues left in each rewrite (grammar_count over correct), so rows that one pass of top-suggestion fixes did not fully clean (issues_after > 0) sort first.
SELECT txt AS original, grammar.main.grammar_count(txt) AS issues_before,
grammar.main.correct(txt) AS corrected,
grammar.main.grammar_count(grammar.main.correct(txt)) AS issues_after
FROM (VALUES ('Thanks for you order, it will ship tomorow.'), ('I could of done it better.'), ('This are a test of the the system.'), ('Your package has been delivered.')) AS t(txt)
ORDER BY issues_after DESC, original;
1 more example
SELECT grammar.main.correct('She go to school evry day.') AS fixed;
grammar_count (text VARCHAR, language VARCHAR) +1 overload
Count grammar, style, and spelling issues in a piece of text, checked in the default language (en-US) with LanguageTool.
grammar_count(text VARCHAR) β INTEGERgrammar_count(text VARCHAR, language VARCHAR) β INTEGER
Count the grammar/spelling issues in a sentence (default en-US).
SELECT grammar.main.grammar_count('She go to the store yesterday.');
Count issues using a specific language; 'colour' flags as a spelling issue in en-US.
SELECT grammar.main.grammar_count('I love this colour.', 'en-US');
SELECT grammar.main.grammar_count('She go to the store yesterday.') AS n;
is_grammatical (text VARCHAR, language VARCHAR) +1 overload
True when a piece of text has zero grammar/style/spelling issues, checked in the default language (en-US) with LanguageTool.
is_grammatical(text VARCHAR) β BOOLEANis_grammatical(text VARCHAR, language VARCHAR) β BOOLEAN
Test whether a sentence is free of issues in the default language (returns true).
SELECT grammar.main.is_grammatical('The quick brown fox jumps.');
Test grammaticality in a specific language (returns false - subject-verb agreement).
SELECT grammar.main.is_grammatical('She don''t like it.', 'en-US');
Rewrite only the rows that fail the grammar check: filter a text column with is_grammatical, then show each failing row's issue count (grammar_count) and its auto-corrected text (correct), worst first.
SELECT txt AS original, grammar.main.grammar_count(txt) AS issues,
grammar.main.correct(txt) AS corrected
FROM (VALUES ('Its a nice day, isnt it?'), ('Your package has been delivered.'), ('I could of done it better.')) AS t(txt)
WHERE NOT grammar.main.is_grammatical(txt)
ORDER BY issues DESC, original;
1 more example
SELECT grammar.main.is_grammatical('The quick brown fox jumps.') AS ok;
grammar_check (text VARCHAR, language := VARCHAR)
Check grammar, style, and spelling of a piece of text with LanguageTool; returns one row per issue with suggested replacements. Accepts an optional language argument (default en-US).
List each grammar/spelling issue in a sentence with its rule, category, flagged text, and suggested fixes, in reading order.
SELECT rule_id, category, message, bad_text, suggestions
FROM grammar.main.grammar_check('She go to school every day.')
ORDER BY "offset";
Show the single best suggested replacement for every fixable issue, checking a specific language variant.
SELECT rule_id, message, suggestions[1] AS top_fix
FROM grammar.main.grammar_check('I has a apple.', language := 'en-US')
WHERE length(suggestions) > 0;
Aggregate how many issues fall into each LanguageTool category for a passage.
SELECT category, count(*) AS issues
FROM grammar.main.grammar_check('Their going too the store, its there problem.')
GROUP BY category
ORDER BY issues DESC;
2 more examples
Explain an auto-correction: list each issue grammar_check flags in a sentence with its category, flagged text, and top suggestion (the replacement correct applies) next to the corrected sentence.
SELECT c.category, c.bad_text, c.suggestions[1] AS applied_fix,
grammar.main.correct('Thanks for you order, it will ship tomorow.') AS corrected
FROM grammar.main.grammar_check('Thanks for you order, it will ship tomorow.') AS c
ORDER BY c."offset";
SELECT rule_id, category, message
FROM grammar.main.grammar_check('She go to school every day.');
Try these queries
Count the writing issues in a piece of text (default en-US).
SELECT grammar.main.grammar_count('I has two dog.') AS issue_count
Uses grammar_count
Test whether text is free of writing issues.
SELECT grammar.main.is_grammatical('The quick brown fox jumps.') AS clean
Uses is_grammatical
Auto-correct text by applying the top suggested fix for each issue.
SELECT grammar.main.correct('She go to school evry day.') AS corrected
Uses correct
List the supported English language codes to pass as the language argument.
SELECT code, name
FROM grammar.main.grammar_languages
WHERE code LIKE 'en-%'
ORDER BY code
Uses grammar_languages
List every supported language code with its human-readable name, alphabetically.
SELECT code, name FROM grammar.main.grammar_languages() ORDER BY code
Filter to the English variants accepted by the language argument.
SELECT code
FROM grammar.main.grammar_languages()
WHERE code LIKE 'en-%'
ORDER BY code
20 more examples in the Catalog, each listed under the table or function it uses.
Questions it can answer
Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.
- Is the sentence 'The quick brown fox jumps over the lazy dog.' grammatically correct? Return a single boolean value.
- Is the sentence 'She go to school every day.' grammatically correct? Return a single boolean value.
- How many grammar, style, or spelling issues does the sentence 'The quick brown fox jumps over the lazy dog.' contain? Return the count as a single number.
- When you check the sentence 'She go to school every day.' for writing problems, does it have at least one issue? Return a single boolean value.
- Return the sentence 'I has a apple.' rewritten with its spelling and grammar automatically corrected.
- Is the language code 'en-GB' one of the languages this worker supports for grammar checking? Return a single boolean value.
Grammar is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
Anthropic
AI & language
Read-only view of your Anthropic organization's members, API keys, token usage and cost
Embed
AI & language
Turn text into embedding vectors on your own machine and rank it by cosine similarity for semantic search and RAG
LLM
AI & language
Call LLMs from SQL β Anthropic, OpenAI, OpenRouter or local Ollama β plus local embeddings