NAME
Lingua::NegEx - Perl extension for finding negated phrases in text and identifying the scope of negation.
SYNOPSIS
use Lingua::NegEx;
my $scope = negation_scope( 'There is no pulmonary embolism.' );
print $scope; # prints '3 - 4'
DESCRIPTION
This is a perl implementation of Wendy Chapman's NegEx algorithm which uses a list of phrases to determine if a negation exists in a sentence and to identify the scope of the given negation.
The one exported function, negation_scope(), takes a sentence as input and returns '-1' if no negation is found or returns the range of word indices that make up the scope of the negation.
This is a near literal translation from the java code authored by Junebae Kye made available online with two explicit additions: 1) the input text is forced into lowercase here 2) non-word characters are stripped from the input text as well.
The $Lingua::NegEx::value flag can be set to 0 to have the function return -2 for post negation phrases.
EXPORT
negation_scope( $text ); # returns -1 if no negation or /\d - \d/ which is the scope of negation
SEE ALSO
The NegEx documentation and downloads for java implementation can be found here:
http://code.google.com/p/negex/
Background information:
http://www.ncbi.nlm.nih.gov/pubmed?cmd=Retrieve&db=PubMed&dopt=AbstractPlus&list_uids=12123149
AUTHOR
Eduardo Iturrate, <ed@iturrate.com>
COPYRIGHT AND LICENSE
Copyright (C) 2013 by Eduardo Iturrate
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.