Skip to content

Readability Analysis

The /read endpoint analyzes a text and returns its word, sentence and syllable counts, its Flesch readability scores and an estimated reading time.

How it works?

English uses the original Flesch coefficients, which also give a Flesch-Kincaid grade level. French uses the Kandel & Moles adaptation, which has no grade-level counterpart, so fleschKincaidGrade is null.

Syllables are estimated with a per-language heuristic: groups of vowels, minus the silent trailing e (e or es in French), with a minimum of one syllable per word. Sentences are split on ., !, ? and , and a text without any of them counts as a single sentence. Reading time is based on 200 words per minute.

Parameters

The request body must be JSON:

ParameterRequiredDescription
textYesText to analyze, 50000 characters maximum
langNoLanguage of the text: en or fr. Default: en

Response Fields

FieldTypeDescription
langstringLanguage used for the analysis
wordsnumberNumber of words — tokens containing at least one letter or digit
sentencesnumberNumber of sentences, always at least 1
syllablesnumberEstimated total number of syllables
fleschReadingEasenumberFlesch reading ease, rounded to 2 decimals — the higher, the easier to read
fleschKincaidGradenumber|nullFlesch-Kincaid grade level, rounded to 2 decimals — null when lang is fr
readingTimestringEstimated reading time, in seconds below a minute (e.g. 45s, 3min)

Code Examples

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "text": "The cat sat on the mat. It was happy.",
    "lang": "en"
  }' \
  "https://api.sylvain.sh/v5/read"

Try It

Error Handling

If parameters are missing or invalid, the API will return an error:

Error MessageDescription
Please provide a textThe text parameter is missing, empty, or contains no word
Text must be 50000 characters or fewerThe text exceeds the maximum length
Language must be one of: en, frThe lang value is neither en nor fr