Part-of-Speech Tag a String, Filter to Adverbs in Go
Using our POS tagging APIs will make it easy to break down input sentences into grammatically tagged portions. Run a sentence through our Adverb POS tagging API and you’ll receive a returned list of adverbs in that sentence. Implement this API easily into your Golang project using the code provided below, or feel free to check out the Cloudmersive API Console page to find code in a language relevant to your project (13 options are available including Java, C#, Python, Node.js, and more).
package mainimport (
"fmt"
"strings"
"net/http"
"io/ioutil"
)func main() {url := "https://api.cloudmersive.com/nlp-v2/pos/tag/adverbs"
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))
}
Missing an API key? Head to our website (www.cloudmersive.com) and create an account to get your API key. Don’t worry about financial commitments — you can make a free-tier account with a limit of 800 API calls per month.