ations
choclate
amit
hi
hello
check
<document>
cheer
chocolate
amit
chase
<document>
chump
hi
hello
champ
chest
chilly
<document>
hello
rose
amit
hi
<document>
hello
hfgf
jsdhj
hi
<document>
hello
amit
hi
<document>
#!/usr/local/bin/perl
open(FL, '/perl/bin/test/genia2.txt');
$cnt=1;
$j=1;
$k=1;
$index=1;
@wordlist;
while(<FL>)
{
chomp($_);
#print "$_ \n";
next if (/^(<document>)$/);
$wordhashfreq{$_}++;
if (exists $wordhash{$_})
{
next;
}
else
{
$wordhash{$_} = $cnt;
#$wordlist[$index] = $_;
#$index++;
$cnt++;
}
}
close FL;
while ( ($key, $value) = each(%wordhashfreq) )
{
if( $wordhashfreq{$key} >=20)
{
# print "$key => $value\n";
push @wordlist, $key;
++$j;
}
}
print "$j \n";
while ($k <= $j)
{
print "$wordlist[$k] \n";
print $wordhash{$wordlist[$k]} . "\t" .
$wordlist[$k] . "\n";
++$k;
}
print "total number $cnt\n";
$len= @wordlist;
print "doing....\n";
foreach $wrd (@wordlist)
{
open(FL, '/perl/bin/test/genia2.txt');
$doc=0;
$am=0;
while(<FL>) {
chomp($_);
if (/^(<document>)$/)
{
if ( $doc == 0)
{
++$doc;
next;
}
else
{
if ($am == 1)
{ $matrix[$doc][$wordhash{$wrd}]=1;
$am =0;
}
else
{$matrix[$doc][$wordhash{$wrd}]=0; }
++$doc;
next;
}
}
if ($_ =~ /$wrd/)
{
$am =1;
}
#print "$_\n";
}
close FL;
if ($am == 1)
{
$matrix[$doc][$wordhash{$wrd}]=1;
}
else
{
$matrix[$doc][$wordhash{$wrd}]=0;
}
}
open(WRITE, ">correlation.txt");
for($x=1; $x<=$doc; ++$x) #$doc
{
$a = 'doc'.$x;
print WRITE "$a\t";
for($y=1; $y<=$cnt; ++$y) #$cnt
{
if ( $matrix[$x][$y]==1 || $matrix[$x][$y]==0)
{
print WRITE "$matrix[$x][$y]";
# print "$matrix[$x][$y] for $lookup_rev{$y}\n";
}
}
print WRITE "\n";
}
close WRITE;
******************************************************************************************************************************
fragment
558Quantifier follows nothing before HERE mark in regex m/+ << HERE /-/ at C:\perl\bin\test\NEW_TE~2.PL line 92, <FL> line 1.
fragment
plus
767 plus
Bcl-2
5091 Bcl-2
least
830 least
adult
1066 adult
required
377 required..............
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
