Lingua-TT

 view release on metacpan or  search on metacpan

tt-tagx-guess.perl  view on Meta::CPAN

    }
  }
  undef $infh;
  $ttin->close;
}

##-- compute analysis-wise tag-probabilities, entropies
my %ax  = qw(); ##-- $a => "$best_tag_for_a".($verbose ? "\tf=f(t,a)\tN=f(a)\tH=$H_2(T|A=a)")
my ($a,$t2f,$n, %t2p,$tp,$H, $fbest,$tbest);
my $log2 = log(2.0);
sub log2 { return $_[0]==0 ? 'NaN' : log($_[0])/$log2; }
foreach my $a (sort keys %atf) {
  $t2f = $atf{$a};
  $n = 0;
  $n += $_ foreach values (%$t2f);

  ##-- normalize
  $H = 0;
  $fbest = -1;
  $tbest = undef;
  foreach $t (keys %$t2f) {



( run in 0.243 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )