Grammar Checker
The /v1/checker endpoint checks the provided text for grammar and spelling errors.
Request
Endpoint
POST /v1/checker
Parameters
| Parameter | Type | Description |
|---|---|---|
| text | String | The text to be checked for grammar and spelling errors. |
Example Request
{
"text": "This is a dinasour."
}
Limits
Maximum length of input text is 60,000 characters.
Response
The response body will be a JSON object containing the following parameters:
| Parameter | Type | Description |
|---|---|---|
| status | Integer | The HTTP status code of the response. |
| alerts | Array of Objects | An array containing objects with details about each alert found. |
| stats | Object | An object containing various statistics about the input text. |
Alert Object
Each object in the "alerts" array contains:
| Parameter | Type | Description |
|---|---|---|
| length | Integer | The length of the word that caused the alert. |
| offset | Integer | The position in the text where the word that caused the alert starts. |
| message | String | A detailed message about the alert. |
| shortMessage | String | A short summary of the alert. |
| category | String | The category of the alert (see 'Grammar categories' below) |
| replacements | Array of Strings | An array of suggested replacements, sorted by descending probability. |
Stats Object
The "stats" object contains:
| Parameter | Type | Description |
|---|---|---|
| wordsCount | Integer | The number of words in the input text. |
| charsCount | Integer | The number of characters in the input text. |
| sentencesCount | Integer | The number of sentences in the input text. |
| avgWordLength | Float | The average length of a word in the input text. |
| avgSentenceLength | Float | The average length of a sentence in the input text. |
| fleschIndex | Float | The Flesch readability score of the input text. |
| readingTimeSeconds | Integer | The estimated time it would take to read the input text. |
| speakingTimeSeconds | Integer | The estimated time it would take to speak the input text. |
| textScore | Integer | A score representing the quality of the input text (0-100). |
Example Response
{
"status": 200,
"alerts": [
{
"length": 8,
"offset": 10,
"message": "Possible spelling mistake found.",
"shortMessage": "Spelling mistake",
"category": "Typos",
"replacements": [
"dinosaur"
]
}
],
"stats": {
"wordsCount": 4,
"charsCount": 16,
"sentencesCount": 1,
"avgWordLength": 3.75,
"avgSentenceLength": 4,
"fleschIndex": 75.87500000000001,
"readingTimeSeconds": 2,
"speakingTimeSeconds": 2,
"textScore": 6
}
}
Grammar Categories
Below are the various categories of grammar alerts that may be returned by the API:
Main Categories
| Category Key | Description |
|---|---|
| CASING | Incorrect use of upper and lower case letters |
| TYPOS | Spelling mistakes |
| COMPOUNDING | Incorrect compounding of words |
| GRAMMAR | Grammatical errors |
| STYLE | Style issues (passive voice, verbosity, cliches) |
| COLLOCATIONS | Inappropriate word combinations |
| PUNCTUATION | Incorrect or missing punctuation |
| CONFUSED_WORDS | Commonly confused words (e.g., "there"/"their") |
| NONSTANDARD_PHRASES | Non-standard phrases in formal writing |
| REDUNDANCY | Redundant phrases or words |
| SEMANTICS | Potentially ambiguous semantic structures |
| PLAIN_ENGLISH | Phrases that could be simplified |
| WIKIPEDIA | Direct quotes from Wikipedia |
| TYPOGRAPHY | Typographic issues (hyphens, dashes) |
| CREATIVE_WRITING | Creative writing enhancement suggestions |
| REPETITIONS_STYLE | Word or phrase repetitions |
| TON_ACADEMIC | Non-academic language or tone |
Detailed Grammar Categories
For complex grammatical errors or language nuances:
| Category Key | Description |
|---|---|
| ADJ | Adjective issues |
| ADJ:FORM | Adjective form issues |
| ADV | Adverb issues |
| CONJ | Conjunction issues |
| CONTR | Contraction issues |
| DET | Determiner issues |
| MORPH | Morphology issues |
| NOUN | Noun issues |
| NOUN:INFL | Noun inflection issues |
| NOUN:NUM | Noun number issues |
| NOUN:POSS | Noun possession issues |
| ORTH | Orthography issues |
| OTHER | Other types of issues |
| PART | Particle issues |
| PREP | Preposition issues |
| PRON | Pronoun issues |
| PUNCT | Punctuation issues |
| SPELL | Spelling issues |
| VERB | Verb issues |
| VERB:FORM | Verb form issues |
| VERB:TENSE | Verb tense issues |
| VERB:SVA | Subject-verb agreement issues |
| VERB:INFL | Verb inflection issues |
| WO | Word order issues |
| UNK | Unknown issues |
Code Examples
TypeScript
import axios from 'axios';
async function checkGrammar(text: string, token: string) {
const response = await axios.post(
'https://api.linguix.com/api/v1/checker',
{
text: text,
},
{
headers: {
'Authorization': `Bearer ${token}`,
},
},
);
console.log(response.data);
}
checkGrammar('This is a dinasour.', '<your-token>');
Python
import requests
import json
def check_grammar(text, token):
headers = {
'Authorization': f'Bearer {token}',
}
data = {'text': text}
response = requests.post('https://api.linguix.com/api/v1/checker', headers=headers, json=data)
print(json.dumps(response.json(), indent=4))
check_grammar('This is a dinasour.', '<your-token>')
Java
import okhttp3.*;
public class Main {
public static void main(String[] args) throws Exception {
String text = "This is a dinasour.";
String token = "<your-token>";
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"text\":\"" + text + "\"}");
Request request = new Request.Builder()
.url("https://api.linguix.com/api/v1/checker")
.post(body)
.addHeader("Authorization", "Bearer " + token)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}