NLP API: Find Spelling Corrections for a Word in Go

Easily incorporate a spellcheck & ‘suggested corrections’ operation into your Golang project with our NLP API. Take advantage of ready-to-run code below, or head to our Cloudmersive API Console page to find code available in 12 other programming languages. This API will take a single input word, determine if the spelling was correct (true/false), and if false, return a list of suggested spellings.

package mainimport (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {url := "https://api.cloudmersive.com/nlp-v2/spellcheck/check/word"
method := "POST"
payload := strings.NewReader("Word=%3Cstring%3E")client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
req.Header.Add("Apikey", "YOUR-API-KEY-HERE")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}

Stuck on “YOUR-API-KEY-HERE”? Head to our website (www.cloudmersive.com) and create an account to receive a key. Among the account options you’ll a free-tier account with a limit of 800 API calls per month. With a single API key, you’ll be able to take advantage of hundreds of Cloudmersive APIs from our API console.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.