jaizendra-netizen / email-readability-score
PHP CLI and library: give each email body in a CSV a rough Flesch reading ease score, flag long sentences and hard-to-read bodies. Offline, a published formula, not a measure of whether an email works.
Package info
github.com/jaizendra-netizen/email-readability-score
Type:project
pkg:composer/jaizendra-netizen/email-readability-score
Requires
- php: >=8.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-11-30 05:56:07 UTC
README
PHP command line tool and library. Give it a CSV of email bodies and it gives each one a rough readability score from a published formula, Flesch reading ease: score = 206.835 - 1.015 * (words / sentences) - 84.6 * (syllables / words). Words are runs of letters, and an apostrophe inside a word is kept. Sentences are runs of text ended by . ! or ? (the last run counts even without an ending mark, and there is at least 1 sentence whenever there is any word); this means a decimal point or an abbreviation such as Mr. splits a sentence. Syllables per word is a rough rule: the number of vowel groups (a e i o u y) in the lower-cased word, minus 1 when the word ends in a single e that is not preceded by a consonant and le, and the word has more than one vowel group, never below 1. It is wrong for some words. Per email it shows the words, the sentences, the words per sentence (1 decimal) and the score (1 decimal), and two flags: long sentences (words per sentence above --max-words, default 20, set by you) and hard (score below --min-score, default 60, set by you). The table is sorted by score, lowest first, then by email_id. The totals give the emails, the median score (1 decimal; for an even count the mean of the two middle scores) and how many emails are flagged hard and long. Scores can be below 0 or above 100. It is a rough score from a published formula, not a measure of whether an email works: it does not read meaning, tone, offer or fit, calls no AI service and makes no network call.
Part of the OneGTMLab free GTM tools. Background on the idea: Saleshandy.
Install
composer require jaizendra-netizen/email-readability-score
Use
Input is a CSV with the columns email_id and body. Column names are matched without regard to case and may be in any order. A body may contain line breaks and commas when it is in double quotes. Option --max-words N (a number above 0, default 20) and option --min-score N (a number, default 60) are both set by you; the flags compare the exact values, not the rounded ones shown. A duplicate email_id, an empty email_id, a body with no words (the row is named), a bad option value, a missing column, a row with the wrong number of cells or a file with no rows exits 1 with a message; an unreadable file, an unknown option or a missing argument exits 2.
$ php bin/email-readability-score sample.csv --max-words 20 --min-score 60
emails read: 4, max words per sentence: 20 (set by you), min score: 60 (set by you)
e03: words 14, sentences 1, words per sentence 14.0, score -133.7, flags: hard
e04: words 28, sentences 1, words per sentence 28.0, score 87.8, flags: long sentences
e02: words 20, sentences 3, words per sentence 6.7, score 102.8, flags: none
e01: words 6, sentences 1, words per sentence 6.0, score 116.1, flags: none
totals: emails 4, median score 95.3, flagged hard 1, flagged long sentences 1
Test
php tests/run.php
Offline, no network calls, no dependencies beyond the language runtime. MIT licensed.