NAME

Text::WordGrams - Calculates statistics on word ngrams.

VERSION

Version 0.07

SYNOPSIS

use Text::WordGrams;

my $data = word_grams( $text );

my $data = word_grams_from_files( $file1, $file2 );

FUNCTIONS

word_grams

Returns a reference to an hash table with word ngrams counts for a specified string. Options are passed as a hash reference as first argument if needed.

Options include:

ignore_case

Set this option to ignore text case;

size

Set this option to the n-gram size you want. Notice that the value should be greater or equal to two. Also, keep in mind that the bigger size you ask for, the larger the hash will become.

tokenize

This option is activated by default. Give a zero value if your document is already tokenized. In this case your text will be slitted by space characters.

word_grams_from_files

Supports the same options of word_grams function, but receives a list of file names instead of a string.

AUTHOR

Alberto Simões, <ambs@cpan.org>

BUGS

Current method is very, very slow. if you find any faster method, please let me know. I think the bottle neck is in the tokenisation part.

Please report any bugs or feature requests to bug-text-wordgrams@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-WordGrams. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2005-2009 Alberto Simões, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.