Text Intelligence
The Text Intelligence APIs make it possible to interact with user-generated text content in a more natural and human-focused way. This begins with our headlining APIs — summarization and sentiment analysis.
Measure word count
Text Intelligence APIs are priced per-word of input. We measure the number of words using a best effort algorithm, but human input is complex.
For this reason, we offer an API to measure a string (at no charge) before submitting it to a paid API. This tells you exactly how many words Apize calculates for a given input.
Required attributes
- Name
text
- Type
- string
- Description
The text string to be measured.
Request
curl https://api.apize.dev/solutions/text/v1/measure \
-H "Authorization: Bearer {YOUR_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"text": "..."}'
Response
{
"data": {
"words": 104
}
}
Summarize text
This API takes in a text string and returns an AI-generated summary.
Required attributes
- Name
text
- Type
- string
- Description
The text string to be summarized.
Optional attributes
- Name
sentences
- Type
- number
- Description
The target number of sentences in the output. This is only a suggestion, and may not always be adhered to. If not provided, a reasonable default is chosen based on the input text.
Request
curl https://api.apize.dev/solutions/text/v1/summarize \
-H "Authorization: Bearer {YOUR_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"text": "..."}'
Response
{
"data": {
"summary": "..."
}
}
Sentiment analysis
This API takes in a text string and returns AI-generated sentiment information.
Required attributes
- Name
text
- Type
- string
- Description
The text string to be analyzed.
Response values
- Name
sentiment
- Type
- string
- Description
Sentiment will be one of the following:
"very_negative"
,"negative"
,"neutral"
,"positive"
,"very_positive"
Request
curl https://api.apize.dev/solutions/text/v1/sentiment \
-H "Authorization: Bearer {YOUR_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"text": "..."}'
Response
{
"data": {
"sentiment": "positive",
}
}
Content matching
This API takes in a text string and a list of categories, and determines how closely the text matches each category.
Required attributes
- Name
text
- Type
- string
- Description
The text string to be analyzed.
- Name
categories
- Type
- string[]
- Description
Array of content categories to check against. Typically a list of adjectives, but you can also include broad subjects or industries.
Response values
- Name
categories
- Type
- Map<string, number>
- Description
A mapping of content categories to numeric ratings, from 0.0 to 1.0.
Request
curl https://api.apize.dev/solutions/text/v1/content-matching \
-H "Authorization: Bearer {YOUR_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"text": "...", "categories": ["political", "angry", "polite"]}'
Response
{
"data": {
"categories": {
"political": 0.2,
"angry": 0.1,
"polite": 0.5,
}
}
}
Grammar
This API takes in a text string and returns the same text with grammatical errors corrected. Optionally, it can also return a human-readable explanation of what was wrong with the grammar in the original.
Required attributes
- Name
text
- Type
- string
- Description
The text string to be analyzed and corrected.
- Name
explain
- Type
- boolean
- Description
Whether or not to include a human-readable grammar explanation in the response.
Response values
- Name
text
- Type
- string
- Description
A revision of the original text string with spelling and grammar corrected.
- Name
explanation
- Type
- string (optional)
- Description
An explanation of the grammatical errors in the original text.
Request
curl https://api.apize.dev/solutions/text/v1/grammar \
-H "Authorization: Bearer {YOUR_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"text": "...", "explain": true}'
Response
{
"data": {
"text": "...",
"explanation": "..."
}
}