Debian Codegraph @

examples/thesaurusV

raw
1 #!/usr/bin/perl -w -s
2
3 our ($ori,$ablt,$rblt) ;
4
5 my ($bl);
6 $bl = $ablt if (defined $ablt) && ($ablt =~ /[A-Za-z]+/);
7 $bl = $rblt if (defined $rblt) && ($rblt =~ /[A-Za-z]+/);
8
9 $/='';
10
11 my $s;
12 while(<>){
13 chomp;
14 if (/^\%baselang(?:uage)?\s+(\S+)/) { $bl ||= $1;
15 while(m{\%(\S+)}g){ $direct{$1}++} }
16 elsif(/^\%(\S+)/) {
17 while(m{\%(\S+)}g){ $direct{$1}++} }
18 elsif(/^#/) { }
19 elsif(/^(\S.*)/) {
20 my $t = $1;
21 my $r = $';
22 while( m{\n(\S+)(?:[ \t]+)((?:.|\n[ \t])*)}g ){
23 my $def=$2;
24 $rel{$1}++;
25 print "Error: $1($t) is empty\n" unless $def =~ /\w/;
26 }}
27 else { print "Error: {$_}\n"}
28 }
29 for (sort keys %direct){ print "\%$_\t= $direct{$_}\n"; }
30 for (sort keys %rel){ print "$_\t= $rel{$_}\n"; }
31
32 __END__
33
34 =head1 NAME
35
36 thesaurusV - Make thesaurus statistics
37
38 =head1 SYNOPSIS
39
40 thesaurusV file.the
41
42 =head1 DESCRIPTION
43
44 Calculates some statistics and simple validations
45
46 Useful for debugging thesaurus...
47
48 =head1 AUTHOR
49
50 J.Joao Almeida, [email protected]
51
52 =head1 SEE ALSO
53
54 perl(1).
55
56 =cut