Biblio-Thesaurus

 view release on metacpan or  search on metacpan

examples/thesaurusV  view on Meta::CPAN

#!/usr/bin/perl -w -s

our ($ori,$ablt,$rblt) ;

my ($bl);
$bl = $ablt if (defined $ablt) && ($ablt =~ /[A-Za-z]+/);
$bl = $rblt if (defined $rblt) && ($rblt =~ /[A-Za-z]+/);

$/='';

my $s;
while(<>){
  chomp;
  if   (/^\%baselang(?:uage)?\s+(\S+)/) { $bl ||= $1;  
     while(m{\%(\S+)}g){ $direct{$1}++}  }
  elsif(/^\%(\S+)/)                     { 
     while(m{\%(\S+)}g){ $direct{$1}++}  }
  elsif(/^#/)                           {   }
  elsif(/^(\S.*)/) { 
    my $t = $1;
    my $r = $';
    while( m{\n(\S+)(?:[ \t]+)((?:.|\n[ \t])*)}g ){
      my $def=$2;
      $rel{$1}++;
      print "Error: $1($t) is empty\n" unless $def =~ /\w/;
    }}
  else { print "Error: {$_}\n"}
}
for (sort keys %direct){ print "\%$_\t= $direct{$_}\n"; }
for (sort keys %rel){ print "$_\t= $rel{$_}\n"; }

__END__

=head1 NAME

thesaurusV - Make thesaurus statistics

=head1 SYNOPSIS

 thesaurusV file.the 

=head1 DESCRIPTION

Calculates some statistics and simple validations

Useful for debugging thesaurus...

=head1 AUTHOR

J.Joao Almeida, jj@di.uminho.pt

=head1 SEE ALSO

perl(1).

=cut      

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.460 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )