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 |
|
---|
26 | ### NOTE if you want to change the collection to use MGPP, then change the
|
---|
27 | ### three mgbuildproc bits in here to mgppbuildproc.
|
---|
28 |
|
---|
29 | package niupepabuildproc;
|
---|
30 |
|
---|
31 | use mgbuildproc;
|
---|
32 | use unicode;
|
---|
33 |
|
---|
34 | BEGIN {
|
---|
35 | @niupepabuildproc::ISA = ('mgbuildproc');
|
---|
36 | }
|
---|
37 |
|
---|
38 |
|
---|
39 | sub new {
|
---|
40 | my $class = shift @_;
|
---|
41 | my $self = new mgbuildproc (@_);
|
---|
42 | return bless $self, $class;
|
---|
43 | }
|
---|
44 |
|
---|
45 | # We want to strip out the macrons if we're indexing the text - we then
|
---|
46 | # strip any macrons from search terms at runtime so that we'll hit all
|
---|
47 | # versions of a word, with or without macrons.
|
---|
48 |
|
---|
49 | # Note that this behaviour may not be best in all cases with Maori text as
|
---|
50 | # there are examples of completely different words being spelt the same
|
---|
51 | # except for their respective macrons. For this collection it seems like
|
---|
52 | # the best solution though.
|
---|
53 | sub filter_text {
|
---|
54 | my $self = shift(@_);
|
---|
55 |
|
---|
56 | if ($self->{'indexing_text'}) {
|
---|
57 | my $unicode_array = &unicode::utf82unicode($_[1]);
|
---|
58 | foreach my $c (@$unicode_array) {
|
---|
59 | if ($c == 256) {$c = ord("A");}
|
---|
60 | elsif ($c == 257) {$c = ord("a");}
|
---|
61 | elsif ($c == 274) {$c = ord("E");}
|
---|
62 | elsif ($c == 275) {$c = ord("e");}
|
---|
63 | elsif ($c == 298) {$c = ord("I");}
|
---|
64 | elsif ($c == 299) {$c = ord("i");}
|
---|
65 | elsif ($c == 332) {$c = ord("O");}
|
---|
66 | elsif ($c == 333) {$c = ord("o");}
|
---|
67 | elsif ($c == 362) {$c = ord("U");}
|
---|
68 | elsif ($c == 363) {$c = ord("u");}
|
---|
69 | }
|
---|
70 | $_[1] = &unicode::unicode2utf8($unicode_array);
|
---|
71 | }
|
---|
72 | }
|
---|
73 |
|
---|
74 | # all documents are "paged" for this collection
|
---|
75 | sub get_document_type {
|
---|
76 | return ("Invisible", "Paged");
|
---|
77 | }
|
---|
78 |
|
---|
79 | 1;
|
---|