| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
143
|
|
|
2
|
5
|
|
|
5
|
|
27
|
use strict; |
|
|
5
|
|
|
|
|
17
|
|
|
|
5
|
|
|
|
|
2691
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Search::Lemur::Database; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Lemur::Database |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 1.0 |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Represent information about an available database. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 Main Methods |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=over 2 |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# create a new C object. This should only be called by a |
|
35
|
|
|
|
|
|
|
# Lemur object, in its _makedbs method. One of these will be created |
|
36
|
|
|
|
|
|
|
# for every database available to the Lemur server. |
|
37
|
|
|
|
|
|
|
# |
|
38
|
|
|
|
|
|
|
# The arguments are database number, title, stop status, stem status, |
|
39
|
|
|
|
|
|
|
# number of docs, number of terms, number of unique terms, average |
|
40
|
|
|
|
|
|
|
# document length. The stop status and stem status |
|
41
|
|
|
|
|
|
|
# are one of 1 or 0, for true and false, respectively. |
|
42
|
|
|
|
|
|
|
# |
|
43
|
|
|
|
|
|
|
# If these arguments are not given, this will return undef |
|
44
|
|
|
|
|
|
|
sub _new { |
|
45
|
9
|
|
|
9
|
|
36
|
my $class = shift; |
|
46
|
9
|
|
|
|
|
11
|
my $self = {}; |
|
47
|
9
|
50
|
|
|
|
22
|
if (scalar(@_) >= 8) { |
|
48
|
9
|
|
|
|
|
18
|
my ($num, $title, $stop, $stem, $numdocs, $numterms, $numuniq, $avgdoclen) = @_; |
|
49
|
9
|
|
|
|
|
57
|
$self = { num => $num, |
|
50
|
|
|
|
|
|
|
title => $title, |
|
51
|
|
|
|
|
|
|
stop => $stop, |
|
52
|
|
|
|
|
|
|
stem => $stem, |
|
53
|
|
|
|
|
|
|
numdocs => $numdocs, |
|
54
|
|
|
|
|
|
|
numterms => $numterms, |
|
55
|
|
|
|
|
|
|
numuniq => $numuniq, |
|
56
|
|
|
|
|
|
|
avgdoclen => $avgdoclen }; |
|
57
|
0
|
|
|
|
|
0
|
} else { return undef; } |
|
58
|
9
|
|
|
|
|
21
|
bless $self, $class; |
|
59
|
9
|
|
|
|
|
21
|
return $self; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item num() |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Get the database number. This number is useful to pass to |
|
65
|
|
|
|
|
|
|
Lemur->d() to specify which database you want to use. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub num { |
|
70
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
71
|
0
|
|
|
|
|
0
|
return $self->{num}; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item title() |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Get the title of this database. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub title { |
|
82
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
83
|
0
|
|
|
|
|
0
|
return $self->{title}; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item stem() |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Gets the stemming status of this database. Returns 1 if the |
|
89
|
|
|
|
|
|
|
database is stemmed, 0 if not. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub stem { |
|
94
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
95
|
0
|
|
|
|
|
0
|
return $self->{stem}; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item stop() |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns the stop word status of this database. Returns 1 if |
|
102
|
|
|
|
|
|
|
the database is stop-worded, 0 if not. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub stop { |
|
107
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
108
|
0
|
|
|
|
|
0
|
return $self->{stop}; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item numdocs() |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Returns the number of documents in this database. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub numdocs { |
|
120
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
121
|
0
|
|
|
|
|
0
|
return $self->{numdocs}; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item numterms() |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Returns the number of terms in this database. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub numterms { |
|
134
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
135
|
0
|
|
|
|
|
0
|
return $self->{numterms}; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item numuniq() |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Returns the number of unique terms in this database. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub numuniq { |
|
147
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
148
|
0
|
|
|
|
|
0
|
return $self->{numuniq}; |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item avgdoclen() |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Returns the average document length in this database. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub avgdoclen { |
|
161
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
162
|
0
|
|
|
|
|
0
|
return $self->{avgdoclen}; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item equals |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Test equality between this database and the given one (used mostly for |
|
170
|
|
|
|
|
|
|
testing). |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub equals { |
|
175
|
5
|
|
|
5
|
1
|
15
|
my $self = shift; |
|
176
|
5
|
|
|
|
|
7
|
my $other = shift; |
|
177
|
5
|
50
|
|
|
|
27
|
return 0 unless ($other->isa('Search::Lemur::Database')); |
|
178
|
5
|
|
33
|
|
|
109
|
return ($self->{title} eq $other->{title}) && |
|
179
|
|
|
|
|
|
|
($self->{num} == $other->{num}) && |
|
180
|
|
|
|
|
|
|
($self->{stem} == $other->{stem}) && |
|
181
|
|
|
|
|
|
|
($self->{stop} == $other->{stop}) && |
|
182
|
|
|
|
|
|
|
($self->{numdocs} == $other->{numdocs}) && |
|
183
|
|
|
|
|
|
|
($self->{numuniq} == $other->{numuniq}) && |
|
184
|
|
|
|
|
|
|
($self->{avgdoclen} == $other->{avgdoclen}) && |
|
185
|
|
|
|
|
|
|
($self->{numterms} == $other->{numterms}); |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=back |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 AUTHOR |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Patrick Kaeding, C<< >> |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head1 BUGS |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
199
|
|
|
|
|
|
|
C, or through the web interface at |
|
200
|
|
|
|
|
|
|
L. |
|
201
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
202
|
|
|
|
|
|
|
your bug as I make changes. |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head1 SUPPORT |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
perldoc Search::Lemur |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
You can also look for information at: |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=over 4 |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
L |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
L |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
L |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=item * Search CPAN |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
L |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=back |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Copyright 2007 Patrick Kaeding, all rights reserved. |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
239
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=cut |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
1; |