source: main/trunk/greenstone2/build-src/src/phind/generate/symbol-names.pl@ 21356

Last change on this file since 21356 was 2675, checked in by paynter, 23 years ago

Changed phind dir to /phind1/ from /phind/.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
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);;
31die "Usage: symbol-names.pl collection [file]\n" unless ($collection);
32
33$vocab = $ENV{'GSDLHOME'} . "/collect/$collection/index/phind1/clauses.vocab";
34if (-e "$vocab") {
35 print "Using vocabulary from: $vocab\n";
36} else {
37 $vocab = $ENV{'GSDLHOME'} . "/collect/$collection/building/phind1/clauses.vocab";
38 if (-e "$vocab") {
39 print "Using vocabulary from: $vocab\n";
40 } else {
41 die "Usage: symbol-names.pl collection [file]\n" unless (-e "$vocab");
42 }
43}
44
45open(V, "<$vocab");
46my $n = 1;
47
48while(<V>) {
49 chomp;
50 $symbol[$n++] = $_;
51}
52
53while(<>) {
54 s/s(\d+)/$symbol[$1]/g;
55 print;
56}
57
Note: See TracBrowser for help on using the repository browser.