source: trunk/niupepa/perllib/niupepabuildproc.pm@ 2874

Last change on this file since 2874 was 2614, checked in by sjboddie, 23 years ago

* empty log message *

  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1###########################################################################
2#
3# mgbuildproc.pm --
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 1999 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
26package niupepabuildproc;
27
28use mgbuildproc;
29use unicode;
30
31BEGIN {
32 @ISA = ('mgbuildproc');
33}
34
35
36sub new {
37 my ($class, $collection, $source_dir, $build_dir,
38 $verbosity, $outhandle) = @_;
39 my $self = new mgbuildproc ();
40
41 return bless $self, $class;
42}
43
44# We want to strip out the macrons if we're indexing the text - we then
45# strip any macrons from search terms at runtime so that we'll hit all
46# versions of a word, with or without macrons.
47
48# Note that this behaviour may not be best in all cases with Maori text as
49# there are examples of completely different words being spelt the same
50# except for their respective macrons. For this collection it seems like
51# the best solution though.
52sub filter_text {
53 my $self = shift(@_);
54
55 if ($self->{'indexing_text'}) {
56 my $unicode_array = &unicode::utf82unicode($_[1]);
57 foreach my $c (@$unicode_array) {
58 if ($c == 256) {$c = ord("A");}
59 elsif ($c == 257) {$c = ord("a");}
60 elsif ($c == 274) {$c = ord("E");}
61 elsif ($c == 275) {$c = ord("e");}
62 elsif ($c == 298) {$c = ord("I");}
63 elsif ($c == 299) {$c = ord("i");}
64 elsif ($c == 332) {$c = ord("O");}
65 elsif ($c == 333) {$c = ord("o");}
66 elsif ($c == 362) {$c = ord("U");}
67 elsif ($c == 363) {$c = ord("u");}
68 }
69 $_[1] = &unicode::unicode2utf8($unicode_array);
70 }
71}
72
73# all documents are "paged" for this collection
74sub get_document_type {
75 return ("Invisible", "Paged");
76}
77
781;
Note: See TracBrowser for help on using the repository browser.