1 | #! /usr/bin/perl -w
|
---|
2 |
|
---|
3 | ###########################################################################
|
---|
4 | #
|
---|
5 | # symbol-names.pl -- Diagnostic tool that substitutes symbols names for
|
---|
6 | # symbol numbers in the output of the suffix program.
|
---|
7 | #
|
---|
8 | # Copyright (C) 2000 Gordon Paynter
|
---|
9 | #
|
---|
10 | # A component of the Greenstone digital library software
|
---|
11 | # from the New Zealand Digital Library Project at the
|
---|
12 | # University of Waikato, New Zealand.
|
---|
13 | #
|
---|
14 | # This program is free software; you can redistribute it and/or modify
|
---|
15 | # it under the terms of the GNU General Public License as published by
|
---|
16 | # the Free Software Foundation; either version 2 of the License, or
|
---|
17 | # (at your option) any later version.
|
---|
18 | #
|
---|
19 | # This program is distributed in the hope that it will be useful,
|
---|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
22 | # GNU General Public License for more details.
|
---|
23 | #
|
---|
24 | # You should have received a copy of the GNU General Public License
|
---|
25 | # along with this program; if not, write to the Free Software
|
---|
26 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
27 | #
|
---|
28 | ###########################################################################
|
---|
29 |
|
---|
30 | $collection = shift(@ARGV);;
|
---|
31 | die "Usage: symbol-names.pl collection [file]\n" unless ($collection);
|
---|
32 |
|
---|
33 | $vocab = $ENV{'GSDLHOME'} . "/collect/$collection/phindex/clauses.vocab";
|
---|
34 | die "Usage: symbol-names.pl collection [file]\n" unless (-e "$vocab");
|
---|
35 |
|
---|
36 | open(V, "<$vocab");
|
---|
37 | my $n = 1;
|
---|
38 |
|
---|
39 | while(<V>) {
|
---|
40 | chomp;
|
---|
41 | $symbol[$n++] = $_;
|
---|
42 | }
|
---|
43 |
|
---|
44 | while(<>) {
|
---|
45 | s/s(\d+)/$symbol[$1]/g;
|
---|
46 | print;
|
---|
47 | }
|
---|
48 |
|
---|