Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.1

Request #4491 Add grade level
Submitted: 2005-05-31 19:56 UTC
From: mjohnson at pitsco dot com Assigned: cweiske
Status: Closed Package: Text_Statistics
PHP Version: Irrelevant OS: NA
Roadmaps: (Not assigned)    
Subscription  


 [2005-05-31 19:56 UTC] mjohnson at pitsco dot com
Description: ------------ Add Flesch-Kincaid grade level. This is calculated with the formula: (0.39 x the average number of words per sentence) + (11.8 x the average number of syllables per word) - 15.59 I've included code in the reproduce code that modifies the _analyze function. I don't have a site I can put it on easily, otherwise I'd post the whole change (which includes the addition of a $gradeLevel variable) Reproduce code: --------------- function _analyze() { $lines = explode("\n", $this->text); foreach( $lines as $line ) { $this->_analyze_line($line); } $nSentences = $this->numSentences; if (empty($nSentences)) { $nSentences = 1; } $nWords = $this->numWords; if (empty($nWords)) { $nWords = 1; } $wordsPerSent = $nWords / $nSentences; $syllablesPerWord = $this->numSyllables/$nWords; $this->flesch = 206.835 - 1.015 * $wordsPerSent - 84.6 * $syllablesPerWord; $this->gradeLevel = 0.39 * $wordsPerSent + 11.8 * $syllablesPerWord - 15.59; }

Comments

 [2007-03-27 12:52 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!