1. Michael Gatto
  2. VersionControl_Hg

Source

VersionControl_Hg / src / Documentation / readability_statistics.txt

The default branch has multiple heads

Readability Statistics of the Tutorials
=======================================

 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


college

0 to 30


college graduate
More info can be read up on WikiPedia article

Example Text_Statistics
<?php
  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()
<?php
 require_once 'Text/Word.php'
 $word = new Text_Word('word');
 $word->numSyllables();  // returns 1
?>