my $counter = Text::WordCounter->new();
my $word_count = $counter->word_count( $text )
It is quite heuristic, for example '-' and digits inside word characters are treated as a word character, see the tests to find out how all the special cases are resolved,
The features parameter should be a hashref and is an accumulator for found features.
If set stemming via Lingua::Stem is performed on the words. We never managed to make it sanely in multilingual texts.
A hashref with words to discard.
is_stop_word
normalize
Lowercases words and stemms them if the stemming attribute is true.
stemming
split_scripts
word_count
Returns a hashref with word counts.
From languages that don't use spaces only Chinese is currently supported (using Lingua::ZH::MMSEG).
__END__
To install Text::WordCounter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::WordCounter
CPAN shell
perl -MCPAN -e shell install Text::WordCounter
For more information on module installation, please visit the detailed CPAN module installation guide.