Enrichments/Classification

Text enrichment APIs offer various enrichment functions that take the raw text as its input and provides a specific enrichment/feature corresponding to the input text. An enrichment function is idempotent and its output is determined by the input text and the underlying predictive (deep learning based) linguistic model. Some examples of these include text based sentiment, readability calculation etc. Most of the underlying methods can be used either using a "GET" or a "POST" HTTP method. For smaller text, the GET method offers better performance and allows for network optimizations such as caching.

Sentiment

Perform sentiment analysis based on the given content (recommend for short content). Support English, French and Spanish.

Securityapi_key
Request
query Parameters
lang
required
string

The two letter language code

Example: lang=en
text
required
string

The text content with UTF-8 text representation

Example: text=We're so happy to see you, and we will be delighted to extend a warm welcome.
Responses
200

200 response

400

Invalid request body

403

The request is forbidden (Please input a valid API key)

get/text/enrichment/sentiment
Request samples
Response samples
application/json
{
  • "status": {
    },
  • "result": {
    }
}

Sentiment

Perform sentiment analysis based on the given content (recommend for long content). Support English, French and Spanish.

Securityapi_key
Request
Request Body schema: application/json
required
text
required
string non-empty

The text content with UTF-8 text representation

lang
required
string

The two letter language code

Enum: "en" "fr" "es"
Responses
200

200 response

400

Invalid request body

403

The request is forbidden (Please input a valid API key)

post/text/enrichment/sentiment
Request samples
application/json
{
  • "text": "We're so happy to see you, and we will be delighted to extend a warm welcome.",
  • "lang": "en"
}
Response samples
application/json
{
  • "status": {
    },
  • "result": {
    }
}

Sentiment classification

Multilingual sentiment classification using LLM models..

Securityapi_key
Request
Request Body schema: application/json
required
text
required
string non-empty

The text content with UTF-8 text representation

ishtml
boolean
Default: false

A boolean flag that should be set to true if text is in HTML markup.

random
number [ 0 .. 1 ]
Default: 0

Controls the amount of randomness in the generated text. Lowering this will result in the output to be more deterministic.

model
string
Default: "gpt4-o"

The generative model to use.

Enum: "gpt4-o" "gpt4-o-mini" "gpt4" "gpt4-t" "o1" "o1-mini"
Responses
200

200 response

post/text/enrichment/sentiment/llm
Request samples
application/json
{
  • "text": "We're so happy to see you, and we will be delighted to extend a warm welcome."
}
Response samples
application/json
{ }

Plain Language Rewrite (EXPERIMENTAL)

Rewrite the given text to be more easier to read and comprehend.

Securityapi_key
Request
Request Body schema: application/json
required
text
required
string non-empty

The text content with UTF-8 text representation

ishtml
boolean
Default: false

A boolean flag that should be set to true if text is in HTML markup.

random
number [ 0 .. 1 ]
Default: 0

Controls the amount of randomness in the generated text. Lowering this will result in the output to be more deterministic.

model
string
Default: "gpt4-o"

The generative model to use.

Enum: "gpt4-o" "gpt4-o-mini" "gpt4" "gpt4-t" "o1" "o1-mini"
Responses
200

200 response

post/text/enrichment/plainlang/rewrite
Request samples
application/json
{
  • "text": "Quantum mechanics is a basic theory in physics that explains how things work at the tiny scale of atoms and subatomic particles. It is the basis for all quantum physics, like quantum chemistry, quantum field theory, quantum technology, and quantum information science."
}
Response samples
application/json
{ }

Readability Rewrite (EXPERIMENTAL)

Rewrite the given text to be suitable for an 8th Grader.

Securityapi_key
Request
Request Body schema: application/json
required
text
required
string non-empty

The text content with UTF-8 text representation

ishtml
boolean
Default: false

A boolean flag that should be set to true if text is in HTML markup.

target
required
string

The target grade level.

Enum: "5" "6" "7" "8-9" "10-12" "college student" "college graduate"
random
number [ 0 .. 1 ]
Default: 0

Controls the amount of randomness in the generated text. Lowering this will result in the output to be more deterministic.

model
string
Default: "gpt4-o"

The generative model to use.

Enum: "gpt4-o" "gpt4-o-mini" "gpt4" "gpt4-t" "o1" "o1-mini"
Responses
200

200 response

post/text/enrichment/readability/rewrite
Request samples
application/json
{
  • "text": "These methods still require supervised training in order to perform a task. When only minimal or no supervised data is available, another line of work has demonstrated the promise of language models to perform specific tasks, such as common sense reasoning (Schwartz et al., 2017) and sentiment analysis (Radford et al., 2017). In this paper, we connect these two lines of work and continue the trend of more general methods of transfer. We demonstrate language models can perform down-stream tasks in a zero-shot setting – without any parameter or architecture modification. We demonstrate this approach shows potential by highlighting the ability of language models to perform a wide range of tasks in a zero-shot setting. We achieve promising, competitive, and state of the art results depending on the task.",
  • "target": "5"
}
Response samples
application/json
{ }

Tone classification

Multilingual tone classification using LLM models..

Securityapi_key
Request
Request Body schema: application/json
required
text
required
string non-empty

The text content with UTF-8 text representation

ishtml
boolean
Default: false

A boolean flag that should be set to true if text is in HTML markup.

random
number [ 0 .. 1 ]
Default: 0

Controls the amount of randomness in the generated text. Lowering this will result in the output to be more deterministic.

model
string
Default: "gpt4-o"

The generative model to use.

Enum: "gpt4-o" "gpt4-o-mini" "gpt4" "gpt4-t" "o1" "o1-mini"
Responses
200

200 response

post/text/enrichment/tone
Request samples
application/json
{
  • "text": "I am afraid I will have to report you. I wish you had behaved better than this."
}
Response samples
application/json
{ }

Sentiment Rewrite (EXPERIMENTAL)

Rewrite the original text to have a more positive sentiment.

Securityapi_key
Request
Request Body schema: application/json
required
text
required
string non-empty

The text content with UTF-8 text representation

ishtml
boolean
Default: false

A boolean flag that should be set to true if text is in HTML markup.

random
number [ 0 .. 1 ]
Default: 0

Controls the amount of randomness in the generated text. Lowering this will result in the output to be more deterministic.

model
string
Default: "gpt4-o"

The generative model to use.

Enum: "gpt4-o" "gpt4-o-mini" "gpt4" "gpt4-t" "o1" "o1-mini"
Responses
200

200 response

post/text/enrichment/sentiment/rewrite
Request samples
application/json
{
  • "text": "If you guys don't make your monthly quotas this month, I will be forced to report you and file an official letter of complaint."
}
Response samples
application/json
{ }

Readability

Compute readability scores by different criteria based on the given English content (recommend for short content)

Securityapi_key
Request
query Parameters
text
required
string

The text content with UTF-8 text representation

Example: text=Peter is a boy. He lives in a village.
Responses
200

200 response

400

Invalid request body

403

The request is forbidden (Please input a valid API key)

get/text/enrichment/readability
Request samples
Response samples
application/json
{
  • "status": {
    },
  • "result": {
    }
}

Readability

Compute readability scores by different criteria based on the given English content (recommend for long content)

Securityapi_key
Request
Request Body schema: application/json
required
text
required
string non-empty

The text content with UTF-8 text representation

lang
required
string

The two letter language code (English only)

Enum: "en" "EN"
Responses
200

200 response

400

Invalid request body

403

The request is forbidden (Please input a valid API key)

post/text/enrichment/readability
Request samples
application/json
{
  • "text": "Environment Canada has ended tornado watches and warnings for eastern Ontario and western Quebec. Several storms came through the region in the afternoon Thursday bringing severe thunderstorm and tornado watches and warnings along the way. At times all of eastern Ontario and Western Quebec had watches or warnings. The Ottawa airport tweeted around 4:40 p.m. that the storms going through the region may have an impact on flights. Fewer than 300 customers were dealing with power outages that began at 4 p.m. Thursday. Power was restored to the area in River ward just before 10 p.m. A spokesperson for Hydro Ottawa said lightning caused the outages. Watches are issued when Environment Canada determines conditions are favourable for the development of thunderstorms strong enough to include a tornado. Tornado warnings are issued when a tornado has been reported or there's credible evidence one is imminent. The tornado watches come less than a month after a weak tornado in the Casselman, Ont., area and a devastating derecho windstorm that knocked out power to hundreds of thousands of customers in the region and killed at least 10 people across Ontario and Quebec.",
  • "lang": "en"
}
Response samples
application/json
{
  • "status": {
    },
  • "result": {
    }
}