NAME

Lingua::EN::Opinion - Measure the positive/negative sentiment of text

VERSION

version 0.03

SYNOPSIS

use Lingua::EN::Opinion;
my $opinion = Lingua::EN::Opinion->new( file => '/some/file.txt' );
$opinion->analyze();
my $sentences = $opinion->sentences;
my $scores = $opinion->scores;
my $averaged = $opinion->averaged_score(5);

DESCRIPTION

A Lingua::EN::Opinion measures the positive/negative sentiment of text.

Please see the eg/ and t/ scripts for example usage.

ATTRIBUTES

file

The text file to analyze.

text

A text string to analyze instead of a text file.

sentences

Computed result.

scores

Computed result.

METHODS

new()

$opinion = Lingua::EN::Opinion->new(%arguments);

Create a new Lingua::EN::Opinion object.

analyze()

$score = $opinion->analyze();

Measure the positive/negative sentiment of text.

averaged_score()

$averaged = $opinion->averaged_score($bins);

Compute the averaged score given a number of (integer) bins (default: 10).

This reduces the amount of "noise" in the original signal. As such, it loses information detail.

For example, if there are 400 sentences, bins of 10 will result in 40 data points. Each point will be the mean of each successive bin-sized set of points in the analyzed score.

SEE ALSO

Moo

File::Slurper

Lingua::EN::Sentence

Statistics::Lite

https://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html#lexicon

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Gene Boggs.

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