Grammatical Error Corrections

Detects grammar, spelling, punctuation, and word choice errors in text, and suggests how to correct them.

Our /gec API gives you access to our top-of-the-line GEC engine. It was specifically developed for this, and it has been fine-tuned accordingly. By integrating this Wordtune API into your writing platform, you can provide your users with the confidence to write without the need to worry about grammar. This is also the engine behind Wordtune - our award winning writing assistant, so you know it's pretty awesome.

You simply need to send some text to the API, and it will return a list of every grammar error, including its location and suggestions for corrections and the type of the error (to indicate to users why it should be fixed).

Features

Fix every grammar error

Allow your users to write with flawless grammar, including tenses, verb additions, changing the order, and everything else you forgot since English high school lessons. No more wondering if it's who or whom.

BeforeAfter
I'm is goingI'm going
I'm going goI'm going to go
I was in the thereI was there

Find all the missing words

It difficult read a sentence like this, isn't it? The GEC API will make it easier for you to do this.

BeforeAfter
This soup very tastyThis soup is very tasty

Punctuation: Punctuation, Punctuation!

Give your users peace of mind without having to worry about double whitespaces, incorrect punctuation, and answering the most annoying question - do I need a hyphen here?

BeforeAfter
Are you going to be there!Are you going to be there?
Hi youHi,

Take the spelling bee by storm

A spell check, but so much more: Capitalizing, changing words that sound the same but spelled differently, and fixing errors caused by typos.

BeforeAfter
I'm not aloud to goI'm not allowed to go
i think i tough i saw you tryti think i thought i saw you try
Let it godLet it go

Avoid repetition of repetitive word repetitions

Do you know the song "I will will always love you"? How about “I will always love you you”? Doesn’t have the same ring, does it? With GEC API you can make sure you’ll always have a hit.

BeforeAfter
Gimme Gimme Gimme a man after midnightGimme a man after midnight

Communicate the right message without using any wrong words

Did you ever use words with similar sounds or spellings? GEC API makes sure you want won't!

BeforeAfter
At times, my job can be quite monogamousAt times, my job can be quite monotonous

Examples

Imagine that you want to integrate the GEC API into your writing platform. To illustrate how you would do it, here is an example:

from ai21 import AI21Client

client = AI21Client(
    # This is the default and can be omitted
    api_key=os.environ.get("AI21_API_KEY"),
)

text = "jazzz is a great stile of music"
response = client.gec.create(text=text)

#  Use the corrections to fix the sentence
corrected_text = text
corrections = response.corrections
for curr_correction in reversed(corrections):
    corrected_text = corrected_text[:curr_correction.start_index] + curr_correction.suggestion + corrected_text[curr_correction.end_index:]

And the fixed sentence:

print(corrected_text)

// Jazz is a great style of music