Text::NSP::Measures::4D::MI - Perl module that provides error checks and framework to implement Loglikelihood for 4-grams.
use Text::NSP::Measures::4D::MI::ll; $ll_value = calculateStatistic( n1111=>8, n1ppp=>306, np1pp=>83, npp1p=>83, nppp1=>57, n11pp=>8, n1p1p=>8, n1pp1=>8, np11p=>83, np1p1=>56, npp11=>56, n111p=>8, n11p1=>8, n1p11=>8, np111=>56, npppp=>15180); if( ($errorCode = getErrorCode())) { print STDERR $erroCode." - ".getErrorMessage()."\n"; } else { print getStatisticName."value for 4-gram is ".$ll_value."\n"; }
This module is the base class for the Loglikelihood and the True Mutual Information measures. All these measure are similar. This module provides error checks specific for these measures, it also implements the computations that are common to these measures.
All these methods use the ratio of the observed values to expected values, for computations, and thus have common error checks, so they have been grouped together.
INPUT PARAMS : $count_values .. Reference of an hash containing the count values computed by the count.pl program.
RETURN VALUES : 1/undef ..returns '1' to indicate success and an undefined(NULL) value to indicate failure.
INPUT PARAMS : $n ..Observed value $m ..Expected value
RETURN VALUES : lognm .. the log of the ratio of observed value to expected value.
Ted Pedersen, University of Minnesota Duluth <tpederse@d.umn.edu>
Satanjeev Banerjee, Carnegie Mellon University <satanjeev@cmu.edu>
Amruta Purandare, University of Pittsburgh <amruta@cs.pitt.edu>
Bridget Thomson-McInnes, University of Minnesota Twin Cities <bthompson@d.umn.edu>
Saiyam Kohli, University of Minnesota Duluth <kohli003@d.umn.edu>
Last updated: $Id: MI.pm,v 1.2 2010/11/12 18:40:23 btmcinnes Exp $
http://groups.yahoo.com/group/ngram/
http://www.d.umn.edu/~tpederse/nsp.html
Copyright (C) 2000-2006, Ted Pedersen, Satanjeev Banerjee, Amruta Purandare, Bridget Thomson-McInnes and Saiyam Kohli
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to
The Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Note: a copy of the GNU General Public License is available on the web at http://www.gnu.org/licenses/gpl.txt and is included in this distribution as GPL.txt.