NAME

Text::IQ - naive intelligence about a body of text

SYNOPSIS

 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;

METHODS

new( path/to/file )

new( scalar_ref )

Constructor method. Returns Text::IQ object. Single argument is either the path to a file or a reference to a simple scalar string.

get_sentences

Wrapper around the Search::Tools::TokenList as_sentences() method. Passes through the same arguments as as_sentences().

num_words

Returns the number of words in the text.

num_sentences

Returns the number of sentences in the text.

avg_word_length

Returns the average number of characters in each word.

avg_sentence_length

Returns the average length of each sentence.

num_complex_words

Returns the number of words with more than 2 syllables.

num_syllables

Returns the total number of syllables in the text.

flesch

Returns the Flesch score per http://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_test.

fog

Returns the Fog score per http://www.plainlanguage.com/Resources/readability.html.

kincaid

Returns the Kincaid score per http://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_test.

AUTHOR

Peter Karman, <karman at cpan.org>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Text::IQ

You can also look for information at:

COPYRIGHT & LICENSE

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.