Extract Sentences from a String in Go

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

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Tunneling your Local Servers

Exploring AppleScript — Part 6

AWS ECS Blue/Green Deployment Setup Using Terraform

Web Development: What One Can Learn From My Experience Trying to Make a Web and Mobile App

What does CCNA 200–301 cover?

API Manage with Google ESP + Google Endpoints + Ingress in Kubernetes

Setting up a python development environment

Which is the fastest sorting algorithm? Can we go faster than that?

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.

More from Medium

Generate a QR code barcode as PNG File in Python

How To Repeat Strings In PHP : str_repeat() — Phpflow.com

CS373 Spring 2022: Dinesh Krishnan Balakrishnan

CS373 Spring 2022: Anthony Hoang