Posted on 2009-07-14 08:28:12-07 by amadaeliseo
Collocations
I have used Text::NSP module and have found most frequent collocations in a text, and ended with this:
$filename = "input.txt"; $outfile="output.txt"; open(INPUT,$filename) or die "Can't open file $filename\n"; open( OUTPUT, "> $outfile") or die "$filename: $!"; undef $/; my $text=<INPUT>; close INPUT; $/ = "\n"; @words = split(/\n/, $text); use Text::NSP::Measures::2D::MI::ll; my $npp = 60; my $n1p = 20; my $np1 = 20; my $n11 = 10; $ll_value = calculateStatistic( n11=>$n11, n1p=>$n1p, np1=>$np1, npp=>$npp); if( ($errorCode = getErrorCode())) { print STDERR $errorCode." - ".getErrorMessage()."\n""; } else { print getStatisticName."value for bigram is ".$ll_value."\n""; }
Something is wrong and it is not working. What? How to fix it?
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.