cvs: peardoc /en/package/text/text-statistics intro.xml

From: Date: Fri, 01 Jul 2005 21:50:41 +0000
Subject: cvs: peardoc /en/package/text/text-statistics intro.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-6434@lists.php.net to get a copy of this message
moosh Fri Jul 1 17:50:41 2005 EDT Added files: /peardoc/en/package/text/text-statistics intro.xml Log: - initial documentation http://cvs.php.net/co.php/peardoc/en/package/text/text-statistics/intro.xml?r=1.1&p=1 Index: peardoc/en/package/text/text-statistics/intro.xml +++ peardoc/en/package/text/text-statistics/intro.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <!-- Credit: George Schlossnagle <george@omniti.com> --> <refentry id="package.text.text-statistics.intro"> <refnamediv> <refname>Introduction</refname> <refpurpose> computation of readability scores for text documents. </refpurpose> </refnamediv> <refsect1> <title>Text_Statistics Description</title> <para> Text_Statistics allows for computation of readability indexes for text documents. </para> <para> 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: <informaltable frame="topbot"> <tgroup cols="2"> <tbody><row> <entry> <para>90 to 100</para> </entry> <entry> <para>5th grade </para> </entry> </row> <row> <entry> <para>80 to 90 </para> </entry> <entry> <para>6th grade </para> </entry> </row> <row> <entry> <para>70 to 80 </para> </entry> <entry> <para>7th grade </para> </entry> </row> <row> <entry> <para>60 to 70 </para> </entry> <entry> <para>8th and 9th grade </para> </entry> </row> <row> <entry> <para>50 to 60 </para> </entry> <entry> <para>10th to 12th grade (high school) </para> </entry> </row> <row> <entry> <para>30 to 50 </para> </entry> <entry> <para>college </para> </entry> </row> <row> <entry> <para>0 to 30 </para> </entry> <entry> <para>college graduate </para> </entry> </row></tbody> </tgroup> </informaltable> More info can be read up on <ulink Lang="en-EN" url="http://en.wikipedia.org/wiki/Flesch-Kincaid_Readability_Test"> WikiPedia article</ulink> </para> <example> <title>Example Text_Statistics</title> <programlisting role="php"> <![CDATA[ <?php require 'Text/Statistics.php'; $block = new Text_Statistics($sometext); $block->flesch; // returns flesch score for $sometext ?> ]]> </programlisting> </example> see the unit tests for additional examples. </para> <para> 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> <title>Example <function>numSyllables</function></title> <programlisting role="php"> <![CDATA[ <?php require_once 'Text/Word.php' $word = new Text_Word('word'); $word->numSyllables(); // returns 1 ?> ]]> </programlisting> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->

« previous php.pear.doc (#6434) next »