Skip to main content

Statistics

The Statistics endpoint computes simple statistics for a given text document. These statistics include word and sentence counts as well as Flesch-Kincaid score.

Statistics POST

Sample Code

curl -X POST https://api.sapling.ai/api/v1/statistics \
-H "Content-Type: application/json" \
-d '{"key":"<api-key>", "text":"Hi, how are you doing?"}'

Sample Response

{
"chars": 22,
"readability": 0.5,
"reading_time_min": 1,
"reading_time_sec": 1.13,
"sentences": 1,
"words": 5
}

Request Parameters

https://api.sapling.ai/api/v1/statistics

HTTP method: POST

The Statistics API POST endpoint takes JSON parameters documented below:

key: String
32-character API key.

text: String
Text to compute statistics for.

session_id: String
Unique name or UUID of document or portion of text that is being processed.

Response Parameters

The Statistics POST endpoint returns JSON of the following format:

{
"chars": 397,
"readability": 7.5, // Flesch-Kincaid readability grade
"reading_time_min": 1,
"reading_time_sec": 15.62,
"sentences": 5,
"words": 69
}