Paraphrase or Rephrase English Text in C/C++

Cloudmersive
2 min readMar 25, 2021

--

When you’re attempting to create engaging and original writing content, it can be difficult to paraphrase information that already captures the message you are trying to convey. This struggle can bring on an intense case of writer’s block, and that’s no joke. Fortunately, we live in an age that offers technology solutions for just about everything, including a tool that can assist in clearing away that writer’s block. The following API leverages Deep Learning AI to create multiple rephrasing candidates per input sentence (English text only), and below are the instructions on how you can use it in C/C++.

To kick things off, we will install libcurl in the C/C++ project:

libcurl/7.75.0

Post-installation, we are ready to perform the function call:

CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.cloudmersive.com/nlp-v2/rephrase/rephrase/eng/by-sentence");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
headers = curl_slist_append(headers, "Apikey: YOUR-API-KEY-HERE");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "TextToTranslate=%3Cstring%3E&TargetRephrasingCount=%3Cinteger%3E";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);

And that’s it! The returned results will provide your rephrased results that preserve the original semantic meaning of the sentence(s). Need an API key? Head to the Cloudmersive website to register for a free account and gain access to 800 monthly calls across our complete API library.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet