Part-of-Speech Tag a String, Filter to Adjectives in Go
1 min readMar 11, 2022
With our NLP API, you can POS-tag any part of a sentence all at once, or individually using separate APIs from the Cloudmersive API Console. Filter our adjectives with tags using our Adjective POS tagging API, and connect using ready-to-run code below for your Golang project. Head to our console page if you’re interested in connecting with a different programming language — there are 13 well-documented options available.
package mainimport (
"fmt"
"strings"
"net/http"
"io/ioutil"
)func main() {url := "https://api.cloudmersive.com/nlp-v2/pos/tag/adjectives"
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))
}
You can create an account to receive an API key on www.cloudmersive.com. There is a free-tier option available with a limit of 800 API calls per month.