Skip to main content

Calculate readability scores. e.g. Flesch, Flesch-Kincaid, and more

Project description

py-readability-metrics

Travis Build Python MIT license

Score the readability of text using popular readability metrics including: Flesch-Kincaid Grade Level, Flesch Reading Ease, Gunning Fog Index, Dale Chall Readability, Automated Readability Index (ARI), Linear Write, SMOG, and Gunning Fog

Install

pip install py-readability-metrics
python -m nltk.downloader punkt

Usage

from readability import Readability

r = Readability(text)

r.flesch_kincaid()
r.flesch()
r.gunning_fog()
r.coleman_liau()
r.dale_chall()
r.ari()
r.linear_write()

*Note: text must contain >= 100 words*

Readability Metric Details

All metrics provide a score attribute. See details below to capture additional detail per metric.

Note: In all examples below r is:

r = Readability(text)

Flesch-Kincaid Grade Level

The U.S. Army uses Flesch-Kincaid Grade Level for assessing the difficulty of technical manuals. The commonwealth of Pennsylvania uses Flesch-Kincaid Grade Level for scoring automobile insurance policies to ensure their texts are no higher than a ninth grade level of reading difficulty. Many other U.S. states also use Flesch-Kincaid Grade Level to score other legal documents such as business policies and financial forms.

call:

r.flesch_kincaid()

example:

fk = r.flesch_kincaid()
print(fk.score)
print(fk.grade_level)

Flesch Reading Ease

The U.S. Department of Defense uses the Reading Ease test as the standard test of readability for its documents and forms. Florida requires that life insurance policies have a Flesch Reading Ease score of 45 or greater.

call:

r.flesch()

example:

f = r.flesch()
print(f.score)
print(f.ease)
print(f.grade_levels)

Dale Chall Readability

The Dale-Chall Formula is an accurate readability formula for the simple reason that it is based on the use of familiar words, rather than syllable or letter counts. Reading tests show that readers usually find it easier to read, process and recall a passage if they find the words familiar.

call:

r.dale_chall()

example:

dc = dale_chall()
print(dc.score)
print(dc.grade_levels)

Automated Readability Index

Unlike the other indices, the ARI, along with the Coleman-Liau, relies on a factor of characters per word, instead of the usual syllables per word. ARI is widely used on all types of texts.

call:

r.ari()

example:

ari = r.ari()
print(ari.score)
print(ari.grade_levels)
print(ari.ages)

Coleman Liau Index

The Coleman-Liau Formula usually gives a lower grade value than any of the Kincaid, ARI and Flesch values when applied to technical documents.

call:

r.coleman_liau()

example:

cl = r.coleman_liau()
print(cl.score)
print(cl.grade_level)

Gunning Fog

The Gunning fog index measures the readability of English writing. The index estimates the years of formal education needed to understand the text on a first reading. A fog index of 12 requires the reading level of a U.S. high school senior (around 18 years old).

call:

r.gunning_fog()

example:

gf = r.gunning_fog()
print(gf.score)
print(gf.grade_level)

SMOG

The SMOG Readability Formula (Simple Measure of Gobbledygook) is a popular method to use on health literacy materials.

call:

r.smog()

example:

s = r.smog()
print(s.score)
print(s.grade_level)

Linear Write

Linsear Write is a readability metric for English text, purportedly developed for the United States Air Force to help them calculate the readability of their technical manuals.

call:

r.linear_write()

example:

lw = r.linear_write()
print(lw.score)
print(lw.grade_level)

Contributing

Contributions are welcome!

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-readability-metrics-0.23.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_readability_metrics-0.23.3-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file py-readability-metrics-0.23.3.tar.gz.

File metadata

  • Download URL: py-readability-metrics-0.23.3.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for py-readability-metrics-0.23.3.tar.gz
Algorithm Hash digest
SHA256 ab8d9cf10a82a41d623cb58cc7adca67e58d5ffd6e8e27cf20974b3e06bc4766
MD5 4e3f6171927c4f93a2de19dd3dc86246
BLAKE2b-256 ea6a72126cbdaab00e4ff80534548545ebcee3002bf034ecea4648f147d224e8

See more details on using hashes here.

File details

Details for the file py_readability_metrics-0.23.3-py3-none-any.whl.

File metadata

  • Download URL: py_readability_metrics-0.23.3-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for py_readability_metrics-0.23.3-py3-none-any.whl
Algorithm Hash digest
SHA256 22bcc1619269d5b6ac9c3d0e9b0db9fa59d03066e5abda9ea95024f4eb15fad7
MD5 058ad7552f1a839adf791b02315fd2cd
BLAKE2b-256 d700ec78c32c48c3b9a090c26391b59f8f9a26ba5099466e42ebc124daf9ceec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page