Part-of-Speech Tag, Filter to Nouns using Go

Cloudmersive
1 min readMar 11, 2022

--

Nice and simple: separate & tag nouns from an input text string with this Part-of-speech tagging iteration of our NLP API. Easily run the below code in your Golang project to connect, or head to the Cloudmersive API Console page to find the right programming language for you (there is code there available in 13 programming languages).

You’ll need a Cloudmersive Account for this, however — so first head to our website (www.cloudmersive.com) and create an account to receive your API key. You can make a free account with a limit of 800 API calls per month.

package mainimport (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {url := "https://api.cloudmersive.com/nlp-v2/pos/tag/nouns"
method := "POST"
payload := strings.NewReader("InputText=%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))
}

--

--

Cloudmersive

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