Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17183 программиста и 1833 робота. Сейчас ищут 1726 программистов ...

Introduction

Вернуться к: Text_Statistics

Introduction

Introduction – computation of readability scores for text documents.

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
?>



Вернуться к: Text_Statistics

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware