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.

tip

This endpoint is free of charge.

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?"}'

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. The current length limit is 50,000 characters; contact us for longer lengths or use our chunking API.

lang: String
Language to compute statistics for. Currently supported languages: en, de, fr, it, nl, pl, ru, ar. Contact us if you need support for other languages.

Response Parameters

The Statistics POST endpoint returns JSON of the following format:

{
"chars": 22,
"readability": 0.5, // Flesch-Kincaid readability grade
"readability_scores": {
"automated_readability_index": -2.1,
"coleman_liau_index": -3.17,
"dale_chall_readability_score": 10.2,
"difficult_words": 1,
"flesch_kincaid_grade": 0.5,
"flesch_reading_ease": 100.24,
"gunning_fog": 2.0,
"linsear_write_formula": 1.5,
"mcalpine_eflaw": 9.0,
"smog_index": 0.0,
"spache_readability": 3.26,
"text_standard": "1st and 2nd grade"
},
"reading_time_min": 1,
"reading_time_sec": 1.13,
"sentences": 1,
"words": 5
}