/usr/share/doc/libbiblio-thesaurus-perl/examples/thesaurus2biling is in libbiblio-thesaurus-perl 0.43-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #!/usr/bin/perl -s
eval 'exec /usr/bin/perl -s -S $0 ${1+"$@"}'
if 0; # not running under some shell
our ($all);
my $langa = shift;
my ($l1,$l2) = ($langa =~ m{(.*)\.\.(.*)});
die("Usage: $0 l1..l2 thesaurus\n") unless $l1 && $l2;
$l1=uc($l1);
$l2=uc($l2);
my $thesaurus= shift or die("Usage: $0 l1..l2 thesaurus\n") ;
die("thesaurus $thesaurus not found\n") unless -f $thesaurus;
use Biblio::Thesaurus;
my $obj = thesaurusLoad($thesaurus);
### open (G,">_bilingue") or die("cant create bilingue");
print "%encoding ",$obj->{encoding},"\n\n" if defined $obj->{encoding};
binmode(STDOUT, $obj->{encoding}.":") if defined $obj->{encoding};
$obj->downtr(
{ $l1 => sub { $p1 = $terms[0] ; },
$l2 => sub { $p2 = $terms[0] ; },
IOF => sub { $cl = join(",",@terms); },
# BT => sub { $bt = join(",",@terms); },
-eachTerm => sub {
if(uc($obj->baselang()) eq $l1) {$p1 = $term; }
if(uc($obj->baselang()) eq $l2) {$p2 = $term; }
# $cl ||=$bt;
if ($p1 || $p2){
$p1 = "[$l1-$l2 $p2]" unless $p1;
$p2 = "[$l2-$l1 $p1]" unless $p2;
if ($all){ print "$p1 : $p2 : $cl\n"}
else { print "$p1 : $p2 : $cl\n" unless $p1 =~ /^[\[]/ || $p2 =~ /^[\[]/ ; }
$p1 = $p2 = $bt = $cl = ""; }
else {""}
}
});
__END__
=head1 NAME
thesaurus2biling - converts a ISO-... thesaurus in a bilingual dictionary
=head1 SYNOPSIS
thesaurus2biling [-all] lang1..lang2 thesaurus > bilingDict
=head1 DESCRIPTION
By default the terms straring with "[" are skiped. Use "-all" option
to obtain all the terms.
=head2 Output Format
<term lang1>:<term lang2>:<class>
<term lang1>:<term lang2>:<class>
=head1 AUTHOR
J.Joao Almeida, jj@di.uminho.pt
=head1 SEE ALSO
perl(1).
=cut
|