| 1 |
Lingua::EN::Fathom - readability and general measurements of English text |
| 2 |
|
| 3 |
SYNOPSIS |
| 4 |
|
| 5 |
use Lingua::EN::Fathom; |
| 6 |
|
| 7 |
my $text = Lingua::EN::Fathom->new(); |
| 8 |
|
| 9 |
$text->analyse_file("sample.txt"); |
| 10 |
|
| 11 |
$accumulate = 1; |
| 12 |
$text->analyse_block($text_string,$accumulate); |
| 13 |
|
| 14 |
# Methods to return statistics on the analysed text |
| 15 |
$text->num_chars; |
| 16 |
$text->num_words; |
| 17 |
$text->percent_complex_words; |
| 18 |
$text->num_sentences; |
| 19 |
$text->num_text_lines; |
| 20 |
$text->num_non_text_lines; |
| 21 |
$text->num_blank_lines; |
| 22 |
$text->num_paragraphs; |
| 23 |
$text->syllables_per_word; |
| 24 |
$text->words_per_sentence; |
| 25 |
$text->unique_words; |
| 26 |
$text->fog; |
| 27 |
$text->flesch; |
| 28 |
$text->kincaid; |
| 29 |
|
| 30 |
|
| 31 |
%words = $text->unique_words; |
| 32 |
foreach $word ( sort keys %words ) |
| 33 |
{ |
| 34 |
print("$words{$word} :$word\n"); |
| 35 |
} |
| 36 |
|
| 37 |
$fog = $text->fog; |
| 38 |
$flesch = $text->flesch; |
| 39 |
$kincaid = $text->kincaid; |
| 40 |
|
| 41 |
print($text->report); |
| 42 |
|
| 43 |
|
| 44 |
DESCRIPTION |
| 45 |
|
| 46 |
This module analyses English text in either a string or file. Totals are |
| 47 |
then calculated for the number of characters, words, sentences, blank |
| 48 |
and non blank (text) lines and paragraphs. |
| 49 |
|
| 50 |
Three common readability statistics are also derived, the Fog, Flesch and |
| 51 |
Kincaid indices. |
| 52 |
|
| 53 |
All of these properties can be accessed through individual methods, or by |
| 54 |
generating a text report. |
| 55 |
|
| 56 |
A hash of all unique words and the number of times they occur is generated. |
| 57 |
|
| 58 |
|
| 59 |
REQUIRES |
| 60 |
|
| 61 |
Lingua::EN::Syllable, Lingua::EN::Sentence |
| 62 |
|
| 63 |
|
| 64 |
HOW TO INSTALL |
| 65 |
|
| 66 |
perl Makefile.PL |
| 67 |
make |
| 68 |
make test |
| 69 |
make install |
| 70 |
|
| 71 |
or.. |
| 72 |
|
| 73 |
perl Build.PL |
| 74 |
build |
| 75 |
build test |
| 76 |
build install |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
AUTHOR |
| 81 |
|
| 82 |
Lingua::EN::Fathom was written by Kim Ryan, kimryan at cpan dot org. |
| 83 |
|
| 84 |
|
| 85 |
COPYRIGHT AND LICENSE |
| 86 |
|
| 87 |
Copyright (c) 2023 Kim Ryan. All rights reserved. |
| 88 |
|
| 89 |
This library is free software; you can redistribute it and/or modify |
| 90 |
it under the same terms as Perl itself. |