GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Text::NSP::Measures::3D(3) User Contributed Perl Documentation Text::NSP::Measures::3D(3)

Text::NSP::Measures::3D - Perl module that provides basic framework for building measure of association for trigrams.

This module can be used as a foundation for building 3-dimensional measures of association that can then be used by statistic.pl. In particular this module provides methods that give convenient access to 3-d (i.e., trigram) frequency counts as created by count.pl, as well as some degree of error handling that verifies the data.

Basic Usage

  use Text::NSP::Measures::3D::MI::ll;

  $ll_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 ".$ll_value."\n";
  }

The methods in this module retrieve observed trigram frequency counts and marginal totals, and also compute expected values. They also provide support for error checking of the output produced by count.pl. These methods are used in all the trigram (3d) measure modules provided in NSP. If you are writing your own 3d measure, you can use these methods as well.

With trigram or 3d measures we use a 3x3 contingency table to store the frequency counts associated with each word in the trigram, as well as the number of times the trigram occurs. The notation we employ is as follows:

Marginal Frequencies:

 n1pp = the number of trigrams where the first word is word1.
 np1p = the number of trigrams where the second word is word2.
 npp1 = the number of trigrams where the third word is word3
 n2pp = the number of trigrams where the first word is not word1.
 np2p = the number of trigrams where the second word is not word2.
 npp2 = the number of trigrams where the third word is not word3.

Observed Frequencies:

 n111 = number of times word1, word2 and word3 occur together in
        their respective positions, joint frequency.
 n112 = number of times word1 and word2 occur in their respective
        positions but word3 does not.
 n121 = number of times word1 and word3 occur in their respective
        positions but word2 does not.
 n211 = number of times word2 and word3 occur in their respective
        positions but word1 does not.
 n122 = number of times word1 occurs in its respective position
        but word2 and word3 do not.
 n212 = number of times word2 occurs in in its respective position
        but word1 and word3 do not.
 n221 = number of times word3 occurs in its respective position
        but word1 and word2 do not.
 n222 = number of time neither word1, word2 or word3 occur in their
        respective positions.

Expected Frequencies:

 m111 = expected number of times word1, word2 and word3 occur together in
        their respective positions.
 m112 = expected number of times word1 and word2 occur in their respective
        positions but word3 does not.
 m121 = expected number of times word1 and word3 occur in their respective
        positions but word2 does not.
 m211 = expected number of times word2 and word3 occur in their respective
        positions but word1 does not.
 m122 = expected number of times word1 occurs in its respective position
        but word2 and word3 do not.
 m212 = expected number of times word2 occurs in in its respective position
        but word1 and word3 do not.
 m221 = expected number of times word3 occurs in its respective position
        but word1 and word2 do not.
 m222 = expected number of time neither word1, word2 or word3 occur in their
        respective positions.

computeObservedValues($count_values) - A method to compute observed values, and also to verify that the computed Observed values are correct, That is they are positive, less than the marginal totals and the total bigram count.
INPUT PARAMS : $count_values .. Reference to an hash consisting of the count values passed to the calculateStatistic() method.

RETURN VALUES : 1/undef ..returns '1' to indicate success and an undefined(NULL) value to indicate failure.

computeExpectedValues($count_values) - A method to compute expected values.
INPUT PARAMS : $count_values .. Reference to an hash consisting of the count output.

RETURN VALUES : 1/undef ..returns '1' to indicate success and an undefined(NULL) value to indicate failure.

computeMarginalTotals($marginal_values) - This method computes the marginal totals from the valuescomputed by the count.pl program and are passed to the calculateStatistic() method.
INPUT PARAMS : $count_values .. Reference to an hash consisting of the frequency combination output.

RETURN VALUES : 1/undef ..returns '1' to indicate success and an undefined(NULL) value to indicate failure.

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: 3D.pm,v 1.15 2008/03/26 17:25:13 tpederse 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.

2008-03-26 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.