Text::IQ - naive intelligence about a body of text
use Text::IQ::EN; # English text my $file = 'path/to/file'; my $iq = Text::IQ::EN->new( $file ); printf("Number of words: %d\n", $iq->num_words); printf("Avg word length: %d\n", $iq->word_length); printf("Number of sentences: %d\n", $iq->num_sentences); printf("Avg sentence length: %d\n", $iq->sentence_length); printf("Misspellings: %d\n", $iq->num_misspellings); printf("Grammar errors: %d\n", $iq->num_grammar_errors); # access internal Search::Tools::TokenList my $tokens = $iq->tokens;
Constructor method. Returns Text::IQ object. Single argument is either the path to a file or a reference to a simple scalar string.
Wrapper around the Search::Tools::TokenList as_sentences() method. Passes through the same arguments as as_sentences().
Returns the number of words in the text.
Returns the number of sentences in the text.
Returns the average number of characters in each word.
Returns the average length of each sentence.
Returns the number of words with more than 2 syllables.
Returns the total number of syllables in the text.
Returns the Flesch score per http://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_test.
Returns the Fog score per http://www.plainlanguage.com/Resources/readability.html.
Returns the Kincaid score per http://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_test.
Peter Karman, <karman at cpan.org>
<karman at cpan.org>
Please report any bugs or feature requests to bug-text-iq at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-IQ. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-text-iq at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Text::IQ
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-IQ
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Text-IQ
CPAN Ratings
http://cpanratings.perl.org/d/Text-IQ
Search CPAN
http://search.cpan.org/dist/Text-IQ/
Copyright 2014 Peter Karman.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Text::IQ, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::IQ
CPAN shell
perl -MCPAN -e shell install Text::IQ
For more information on module installation, please visit the detailed CPAN module installation guide.