Text::NSP::Measures::3D::MI::ps is a Perl module that implements Poisson Stirling Measure for trigrams.
SYNOPSIS
Basic Usage
use Text::NSP::Measures::3D::MI::ps;
$ps_value = calculateStatistic( n111=>10,
n1pp=>40,
np1p=>45,
npp1=>42,
n11p=>20,
n1p1=>23,
np11=>21,
nppp=>100);
if( ($errorCode = getErrorCode()))
{
print STDERR $erroCode." - ".getErrorMessage()."n";
}
else
{
print getStatisticName."value for bigram is ".$ps_value."n";
}
The log-likelihood ratio measures the devitation between the observed data and what would be expected if < word1 >, < word2 > and < word3 > were independent. The higher the score, the less evidence there is in favor of concluding that the words are independent.
The expected values for the internal cells are calculated by taking the product of their associated marginals and dividing by the sample size, for example:
n1pp * np1p * npp1
m111= --------------------
nppp
The poisson stirling measure is a negative lograthimic approximation of the poisson-likelihood measure. It uses the stirlings firmula to approximate the factorial in poisson-likelihood measure. It is computed as follows:
Posson-Stirling = n111 * ( log(n111) - log(m111) - 1)
Methods
calculateStatistic() - This method calculates the ps value
INPUT PARAMS : $count_values .. Reference of an hash containing the count values computed by the count.pl program.
RETURN VALUES : $poissonStirling .. Poisson-Stirling value for this trigram.
getStatisticName() - Returns the name of this statistic
INPUT PARAMS : none
RETURN VALUES : $name .. Name of the measure.
Product's homepage
Requirements:
· Perl