Readability and Summarization¶
2 endpoints for readability scoring and extractive summarization.
| Method |
Endpoint |
Purpose |
POST |
/v1/text/readability |
Compute readability metrics and interpretation |
POST |
/v1/text/summarize |
Return top ranked sentences as summary |
Python SDK Examples¶
Readability metrics¶
from toolkitapi import TextAnalysis
text = """
Modern software systems benefit from clear, concise documentation.
Readable writing lowers onboarding time and reduces operational mistakes.
""".strip()
with TextAnalysis(api_key="tk_...") as ta:
result = ta.readability(text=text)
print(result["statistics"]["word_count"])
print(result["scores"]["flesch_reading_ease"])
print(result["interpretation"]["audience"])
from toolkitapi import TextAnalysis
text = """
Text analysis provides measurable signals for content quality.
Readability scores help writers tune complexity for target audiences.
Similarity and diff endpoints support editorial workflows.
PII masking helps teams sanitize logs before sharing.
""".strip()
with TextAnalysis(api_key="tk_...") as ta:
summary = ta.summarize(text=text, sentence_count=2)
print(summary["summary"])
print(summary["sentence_count"], summary["original_sentence_count"])
Request Parameters¶
POST /v1/text/readability¶
| Parameter |
Type |
Description |
text |
string |
Input text, max 1048576 characters |
POST /v1/text/summarize¶
| Parameter |
Type |
Description |
text |
string |
Input text, max 1048576 characters |
sentence_count |
integer |
Number of output sentences, 1 to 50 |
Response Fields¶
Readability¶
| Field |
Type |
Description |
statistics.word_count |
integer |
Total words |
statistics.sentence_count |
integer |
Total sentences |
statistics.syllable_count |
integer |
Total syllables |
statistics.character_count |
integer |
Total characters (letters in tokenized words) |
statistics.complex_word_count |
integer |
Words with 3 or more syllables |
scores.flesch_reading_ease |
number |
Flesch reading ease score |
scores.flesch_kincaid_grade |
number |
Grade level estimate |
scores.gunning_fog |
number |
Gunning Fog index |
scores.coleman_liau |
number |
Coleman-Liau index |
scores.automated_readability_index |
number |
ARI score |
interpretation.level |
string |
Human readable level |
interpretation.audience |
string |
Intended audience band |
Summarize¶
| Field |
Type |
Description |
summary |
string |
Combined summary text |
sentence_count |
integer |
Number of selected summary sentences |
original_sentence_count |
integer |
Sentence count in original text |
sentences |
array |
Selected sentence objects with index and score |
Tip
Summarization is extractive, not generative. It picks high scoring original sentences, so source sentence quality directly determines summary quality.