Score the readability of text using popular readability formulas and metrics including: Flesch Kincaid Grade Level, Flesch Reading Ease, Gunning Fog Index, Dale Chall Readability, Automated Readability Index (ARI), Coleman Liau Index, Linsear Write, SMOG, and SPACHE.
- Python 3.12 or higher
pip install readscorefrom readscore import Readability
text = """
In linguistics, the Gunning fog index is a readability test for English writing.
The index estimates the years of formal education a person needs to understand
the text on the first reading. For instance, a fog index of 12 requires the
reading level of a United States high school senior (around 18 years old).
The test was developed in 1952 by Robert Gunning, an American businessman
who had been involved in newspaper and textbook publishing.
"""
r = Readability(text)
# Automated Readability Index (ARI)
ari = r.ari()
print(f"ARI Score: {ari.score}")
print(f"Grade Levels: {ari.grade_levels}")
print(f"Ages: {ari.ages}")
# Flesch Reading Ease
flesch = r.flesch()
print(f"Flesch Score: {flesch.score}")
print(f"Ease: {flesch.ease}")
# Flesch-Kincaid Grade Level
fk = r.flesch_kincaid()
print(f"FK Score: {fk.score}")
print(f"Grade Level: {fk.grade_level}")
# Get all statistics used for calculation
stats = r.statistics()
print(stats)
# For custom metrics, use r.stats (returns a StatSummary object)
print(r.stats)For score interpretation, metric selection, and full API docs, see readscore.plainlicense.org.
readscore is a fork of the excellent py-readability-metrics library by Carmine DiMascio (@cdimascio). We wanted to build on the great work that Carmine did, and add some additional features and metrics as an engine for future Plain License projects, like our in-development CLI tool, plainr and similar plain language focused CI/CD tools. We also wanted to make some major breaking changes to the API and add robust typing support, so we decided to fork the project and start fresh.
- ARI (Automated Readability Index)
- Coleman-Liau Index
- Dale-Chall Readability Score
- Flesch Reading Ease
- Flesch-Kincaid Grade Level
- Gunning Fog Index
- Linsear Write Formula
- SMOG Index
- Spache Readability Formula
readscore is a fork of py-readability-metrics by Carmine DiMascio. We are grateful for that foundation.