Introduction – computation of readability scores for text documents.

Text_Statistics Description

Text_Statistics allows for computation of readability indexes for text documents.

Text_Statistics calculates some basic readability metrics on a block of text. The number of words, the number of sentences, and the number of total syllables is counted. These statistics can be used to calculate the Flesch score for a sentence, which is a number (usually between 0 and 100) that represents the readability of the text. A basic breakdown of scores is:

90 to 100

5th grade

80 to 90

6th grade

70 to 80

7th grade

60 to 70

8th and 9th grade

50 to 60

10th to 12th grade (high school)

30 to 50


0 to 30

college graduate

More info can be read up on WikiPedia article

Example Text_Statistics

require 'Text/Statistics.php';
$block = new Text_Statistics($sometext);
$block->flesch// returns flesch score for $sometext

see the unit tests for additional examples.

Text_Word calculates the number of syllables in a word, based off of the number of contiguous vowel groupings in the word and applying matches to detect special cases.

Example numSyllables()

require_once 'Text/Word.php'
$word = new Text_Word('word');
$word->numSyllables();  // returns 1
Text_Statistics (Previous) Text_Wiki (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.