2017-09-14 03:09:36 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
my %terms;
|
2018-02-12 00:04:20 +00:00
|
|
|
my %unscoped;
|
|
|
|
my $depth = 0;
|
|
|
|
|
2017-09-14 03:09:36 +00:00
|
|
|
while (<STDIN>) {
|
2018-02-12 00:04:20 +00:00
|
|
|
++$depth if m/\.proc/ || m/\.scope/;
|
|
|
|
--$depth if m/\.endproc/ || m/\.endscope/;
|
2017-09-14 03:09:36 +00:00
|
|
|
foreach my $term (split /\b/, $_) {
|
2018-02-12 00:04:20 +00:00
|
|
|
if ($term =~ /^L[0-9A-F]{4}$/) {
|
|
|
|
$terms{$term} = 0 unless defined $terms{$term};
|
|
|
|
$terms{$term} += 1;
|
|
|
|
$unscoped{$term} = 1 if $depth < 2;
|
|
|
|
}
|
2017-09-14 03:09:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-12 00:04:20 +00:00
|
|
|
my $single = 0;
|
|
|
|
foreach my $key (keys %terms) {
|
|
|
|
++$single if $terms{$key} == 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
my $terms = scalar(keys %terms);
|
|
|
|
my $unscoped = scalar(keys %unscoped);
|
|
|
|
my $scoped = $terms - $unscoped;
|
|
|
|
|
|
|
|
print "unscoped: $unscoped scoped: $scoped single: $single\n";
|