line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::IndexSet; |
2
|
5
|
|
|
5
|
|
36
|
use strict; |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
142
|
|
3
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
115
|
|
4
|
5
|
|
|
5
|
|
31
|
use UNIVERSAL; |
|
5
|
|
|
|
|
23
|
|
|
5
|
|
|
|
|
25
|
|
5
|
5
|
|
|
5
|
|
129
|
use Scalar::Util qw(blessed); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
23376
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new |
10
|
|
|
|
|
|
|
{ |
11
|
3570
|
|
|
3570
|
1
|
6898
|
my ($class,$words_a) = @_; |
12
|
3570
|
|
|
|
|
5947
|
my $this = {}; |
13
|
3570
|
|
|
|
|
6058
|
bless ($this,$class); |
14
|
3570
|
|
|
|
|
7665
|
$this->{INDEXES} = []; |
15
|
3570
|
|
|
|
|
7121
|
return $this; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub copy |
19
|
|
|
|
|
|
|
{ |
20
|
148
|
|
|
148
|
1
|
264
|
my ($this) = @_; |
21
|
148
|
|
|
|
|
627
|
my $new = Lingua::YaTeA::IndexSet->new; |
22
|
148
|
|
|
|
|
210
|
my $index; |
23
|
148
|
|
|
|
|
231
|
foreach $index (@{$this->getIndexes}) |
|
148
|
|
|
|
|
286
|
|
24
|
|
|
|
|
|
|
{ |
25
|
564
|
|
|
|
|
759
|
push @{$new->getIndexes}, $index; |
|
564
|
|
|
|
|
909
|
|
26
|
|
|
|
|
|
|
} |
27
|
148
|
|
|
|
|
479
|
return $new; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub getIndex |
32
|
|
|
|
|
|
|
{ |
33
|
20544
|
|
|
20544
|
1
|
33753
|
my ($this,$rank) = @_; |
34
|
20544
|
|
|
|
|
30977
|
return $this->getIndexes->[$rank]; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub getIndexes |
38
|
|
|
|
|
|
|
{ |
39
|
82357
|
|
|
82357
|
1
|
122457
|
my ($this) = @_; |
40
|
82357
|
|
|
|
|
198748
|
return $this->{INDEXES}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub getLast |
46
|
|
|
|
|
|
|
{ |
47
|
2564
|
|
|
2564
|
1
|
4561
|
my ($this) = @_; |
48
|
2564
|
|
|
|
|
4423
|
return $this->getIndexes->[$#{$this->getIndexes}]; |
|
2564
|
|
|
|
|
4020
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub getFirst |
52
|
|
|
|
|
|
|
{ |
53
|
2395
|
|
|
2395
|
1
|
4095
|
my ($this) = @_; |
54
|
2395
|
|
|
|
|
4020
|
return $this->getIndexes->[0]; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub appearsIn |
59
|
|
|
|
|
|
|
{ |
60
|
0
|
|
|
0
|
1
|
0
|
my ($this,$larger_index_set) = @_; |
61
|
0
|
|
|
|
|
0
|
my $index; |
62
|
0
|
|
|
|
|
0
|
foreach $index (@{$this->getIndexes}) |
|
0
|
|
|
|
|
0
|
|
63
|
|
|
|
|
|
|
{ |
64
|
0
|
0
|
|
|
|
0
|
if(! $larger_index_set->indexExists($index)) |
65
|
|
|
|
|
|
|
{ |
66
|
0
|
|
|
|
|
0
|
return 0; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
0
|
|
|
|
|
0
|
return 1; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub searchSubIndexesSet |
74
|
|
|
|
|
|
|
{ |
75
|
27
|
|
|
27
|
1
|
98
|
my ($this,$words_a,$chunking_data,$tag_set) = @_; |
76
|
27
|
|
|
|
|
57
|
my @sub_indexes_set; |
77
|
|
|
|
|
|
|
my $sub_index; |
78
|
|
|
|
|
|
|
|
79
|
27
|
|
|
|
|
71
|
my $max = (2**$this->getSize) -1; |
80
|
27
|
|
|
|
|
61
|
my $i; |
81
|
|
|
|
|
|
|
|
82
|
27
|
|
|
|
|
79
|
for ($i = 1; $i <= $max; $i++) |
83
|
|
|
|
|
|
|
{ |
84
|
2717
|
|
|
|
|
4963
|
$sub_index = $this->searchSubIndexes($i,$words_a,$this->getSize,$chunking_data,$tag_set); |
85
|
2717
|
100
|
66
|
|
|
10548
|
if ((blessed($sub_index)) && ($sub_index->isa('Lingua::YaTeA::IndexSet'))) { # the substring is valid |
86
|
277
|
|
|
|
|
975
|
push @sub_indexes_set, $sub_index; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
27
|
|
|
|
|
119
|
@sub_indexes_set = sort ({scalar @{$b->getIndexes} <=> scalar @{$a->getIndexes}}@sub_indexes_set); |
|
899
|
|
|
|
|
1203
|
|
|
899
|
|
|
|
|
1332
|
|
|
899
|
|
|
|
|
1339
|
|
91
|
27
|
|
|
|
|
137
|
return \@sub_indexes_set; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub isCoveredBy |
98
|
|
|
|
|
|
|
{ |
99
|
60
|
|
|
60
|
1
|
105
|
my ($this,$other_index) = @_; |
100
|
60
|
|
|
|
|
97
|
my $more_than_one_in_common = 0; |
101
|
60
|
100
|
100
|
|
|
101
|
if |
102
|
|
|
|
|
|
|
( |
103
|
|
|
|
|
|
|
($this->getLast <= $other_index->getFirst) |
104
|
|
|
|
|
|
|
|| |
105
|
|
|
|
|
|
|
($this->getFirst >= $other_index->getLast) |
106
|
|
|
|
|
|
|
) |
107
|
|
|
|
|
|
|
{ |
108
|
|
|
|
|
|
|
# they do not cover at all; |
109
|
21
|
|
|
|
|
91
|
return 0; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
# if($this->isDisjuncted($other_index)) |
113
|
|
|
|
|
|
|
# { |
114
|
|
|
|
|
|
|
# return 0; |
115
|
|
|
|
|
|
|
# } |
116
|
|
|
|
|
|
|
else |
117
|
|
|
|
|
|
|
{ |
118
|
39
|
100
|
100
|
|
|
81
|
if( |
119
|
|
|
|
|
|
|
($this->getFirst < $other_index->getFirst) |
120
|
|
|
|
|
|
|
&& |
121
|
|
|
|
|
|
|
($this->getLast > $other_index->getLast) |
122
|
|
|
|
|
|
|
) |
123
|
|
|
|
|
|
|
{ |
124
|
|
|
|
|
|
|
# this one is larger than the other |
125
|
12
|
|
|
|
|
50
|
return 0; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
else |
128
|
|
|
|
|
|
|
{ |
129
|
|
|
|
|
|
|
# $more_than_one_in_common = $this->moreThanOneInCommon($other_index); |
130
|
|
|
|
|
|
|
|
131
|
27
|
|
|
|
|
87
|
return ($this->moreThanOneInCommon($other_index)); |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
} |
134
|
0
|
|
|
|
|
0
|
return 1; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub isDisjuncted |
139
|
|
|
|
|
|
|
{ |
140
|
0
|
|
|
0
|
1
|
0
|
my ($this,$other_index) = @_; |
141
|
0
|
0
|
0
|
|
|
0
|
if |
142
|
|
|
|
|
|
|
( |
143
|
|
|
|
|
|
|
($this->getLast < $other_index->getFirst) |
144
|
|
|
|
|
|
|
|| |
145
|
|
|
|
|
|
|
($this->getFirst > $other_index->getLast) |
146
|
|
|
|
|
|
|
) |
147
|
|
|
|
|
|
|
{ |
148
|
|
|
|
|
|
|
# they do not cover at all; |
149
|
0
|
|
|
|
|
0
|
return 1; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
} |
152
|
0
|
|
|
|
|
0
|
return 0; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub getIncluded |
156
|
|
|
|
|
|
|
{ |
157
|
0
|
|
|
0
|
1
|
0
|
my ($this,$other_index_sets_a,$parsing_direction) = @_; |
158
|
0
|
|
|
|
|
0
|
my $index_set; |
159
|
|
|
|
|
|
|
my @included; |
160
|
0
|
|
|
|
|
0
|
foreach $index_set (@{$other_index_sets_a}) |
|
0
|
|
|
|
|
0
|
|
161
|
|
|
|
|
|
|
{ |
162
|
0
|
0
|
0
|
|
|
0
|
if( |
|
|
|
0
|
|
|
|
|
163
|
|
|
|
|
|
|
($this->getFirst < $index_set->getFirst) |
164
|
|
|
|
|
|
|
&& |
165
|
|
|
|
|
|
|
($this->getLast > $index_set->getLast) |
166
|
|
|
|
|
|
|
&& |
167
|
|
|
|
|
|
|
(!$this->moreThanOneInCommon($index_set)) |
168
|
|
|
|
|
|
|
) |
169
|
|
|
|
|
|
|
{ |
170
|
0
|
|
|
|
|
0
|
push @included, $index_set; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
} |
173
|
0
|
|
|
|
|
0
|
$this->sortIncluded(\@included, $parsing_direction); |
174
|
0
|
|
|
|
|
0
|
return \@included; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub sortIncluded |
179
|
|
|
|
|
|
|
{ |
180
|
0
|
|
|
0
|
0
|
0
|
my ($this,$included_index_sets_a,$parsing_direction) = @_; |
181
|
0
|
0
|
|
|
|
0
|
if($parsing_direction eq "RIGHT") |
182
|
|
|
|
|
|
|
{ |
183
|
0
|
|
|
|
|
0
|
@$included_index_sets_a = sort ({$b->getLast <=> $a->getLast} @$included_index_sets_a); |
|
0
|
|
|
|
|
0
|
|
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
else |
186
|
|
|
|
|
|
|
{ |
187
|
0
|
|
|
|
|
0
|
@$included_index_sets_a = sort ({$b->getFirst <=> $b->getFirst} @$included_index_sets_a); |
|
0
|
|
|
|
|
0
|
|
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub isIncluded |
192
|
|
|
|
|
|
|
{ |
193
|
0
|
|
|
0
|
1
|
0
|
my ($this,$other_index,$pivot) = @_; |
194
|
0
|
0
|
0
|
|
|
0
|
if( |
|
|
|
0
|
|
|
|
|
195
|
|
|
|
|
|
|
($this->getFirst >= $other_index->getFirst) |
196
|
|
|
|
|
|
|
&& |
197
|
|
|
|
|
|
|
($this->getLast <= $other_index->getLast) |
198
|
|
|
|
|
|
|
&& |
199
|
|
|
|
|
|
|
(!$this->moreThanOneInCommon($other_index) |
200
|
|
|
|
|
|
|
) |
201
|
|
|
|
|
|
|
) |
202
|
|
|
|
|
|
|
{ |
203
|
0
|
0
|
0
|
|
|
0
|
if( |
204
|
|
|
|
|
|
|
(!defined $pivot) |
205
|
|
|
|
|
|
|
|| |
206
|
|
|
|
|
|
|
($this->checkInclusion($other_index,$pivot)) |
207
|
|
|
|
|
|
|
) |
208
|
|
|
|
|
|
|
{ |
209
|
0
|
|
|
|
|
0
|
return 1; |
210
|
|
|
|
|
|
|
} |
211
|
0
|
|
|
|
|
0
|
return 0; |
212
|
|
|
|
|
|
|
} |
213
|
0
|
|
|
|
|
0
|
return 0; |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub checkInclusion |
218
|
|
|
|
|
|
|
{ |
219
|
0
|
|
|
0
|
1
|
0
|
my ($this,$other_index,$pivot) = @_; |
220
|
|
|
|
|
|
|
|
221
|
0
|
|
|
|
|
0
|
my $previous = $other_index->findPrevious($pivot); |
222
|
0
|
|
|
|
|
0
|
my $next = $other_index->findNext($pivot); |
223
|
0
|
0
|
0
|
|
|
0
|
if( |
224
|
|
|
|
|
|
|
($previous == -1) |
225
|
|
|
|
|
|
|
|| |
226
|
|
|
|
|
|
|
($previous < $this->getFirst) |
227
|
|
|
|
|
|
|
) |
228
|
|
|
|
|
|
|
{ |
229
|
0
|
0
|
0
|
|
|
0
|
if( |
230
|
|
|
|
|
|
|
($next == -1) |
231
|
|
|
|
|
|
|
|| |
232
|
|
|
|
|
|
|
($next > $this->getLast) |
233
|
|
|
|
|
|
|
) |
234
|
|
|
|
|
|
|
{ |
235
|
0
|
|
|
|
|
0
|
return 1; |
236
|
|
|
|
|
|
|
} |
237
|
0
|
|
|
|
|
0
|
return 0; |
238
|
|
|
|
|
|
|
} |
239
|
0
|
|
|
|
|
0
|
return 0; |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub appendPosition |
244
|
|
|
|
|
|
|
{ |
245
|
23
|
|
|
23
|
1
|
59
|
my ($this,$pivot) = @_; |
246
|
23
|
50
|
|
|
|
58
|
if($pivot == $this->getFirst) |
247
|
|
|
|
|
|
|
{ |
248
|
0
|
|
|
|
|
0
|
return "LEFT"; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
else |
251
|
|
|
|
|
|
|
{ |
252
|
23
|
100
|
|
|
|
71
|
if($pivot == $this->getLast) |
253
|
|
|
|
|
|
|
{ |
254
|
19
|
|
|
|
|
58
|
return "RIGHT"; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
else |
257
|
|
|
|
|
|
|
{ |
258
|
4
|
|
|
|
|
14
|
return "MIDDLE"; |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
sub adjunctionType |
264
|
|
|
|
|
|
|
{ |
265
|
0
|
|
|
0
|
1
|
0
|
my ($this,$other_index,$pivot) = @_; |
266
|
0
|
0
|
|
|
|
0
|
if ($this->getFirst == $other_index->getLast) |
267
|
|
|
|
|
|
|
{ |
268
|
0
|
|
|
|
|
0
|
return "ADJUNCTION_LEFT"; |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
else |
271
|
|
|
|
|
|
|
{ |
272
|
0
|
0
|
|
|
|
0
|
if($this->getLast == $other_index->getFirst) |
273
|
|
|
|
|
|
|
{ |
274
|
0
|
|
|
|
|
0
|
return "ADJUNCTION_RIGHT"; |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
else |
277
|
|
|
|
|
|
|
{ |
278
|
0
|
|
|
|
|
0
|
return "ADJUNCTION_MIDDLE"; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
} |
281
|
0
|
|
|
|
|
0
|
return; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub moreThanOneInCommon |
285
|
|
|
|
|
|
|
{ |
286
|
36
|
|
|
36
|
1
|
81
|
my ($this,$other_index) = @_; |
287
|
36
|
|
|
|
|
62
|
my $counter = 0; |
288
|
36
|
|
|
|
|
57
|
my $i = 0; |
289
|
36
|
|
|
|
|
57
|
my $j = 0; |
290
|
|
|
|
|
|
|
|
291
|
36
|
|
66
|
|
|
100
|
while ( |
292
|
|
|
|
|
|
|
($i < $this->getSize) |
293
|
|
|
|
|
|
|
&& |
294
|
|
|
|
|
|
|
($j < $other_index->getSize) |
295
|
|
|
|
|
|
|
) |
296
|
|
|
|
|
|
|
{ |
297
|
36
|
|
|
|
|
84
|
while ($other_index->getIndex($j) == $this->getIndex($i)) |
298
|
|
|
|
|
|
|
{ |
299
|
43
|
|
|
|
|
76
|
$counter++; |
300
|
43
|
100
|
|
|
|
100
|
if($counter > 1) |
301
|
|
|
|
|
|
|
{ |
302
|
16
|
|
|
|
|
59
|
return 1; |
303
|
|
|
|
|
|
|
} |
304
|
27
|
|
|
|
|
46
|
$i++; |
305
|
27
|
|
|
|
|
44
|
$j++; |
306
|
27
|
100
|
66
|
|
|
55
|
if( |
307
|
|
|
|
|
|
|
($i >= $this->getSize) |
308
|
|
|
|
|
|
|
|| |
309
|
|
|
|
|
|
|
($j >= $other_index->getSize) |
310
|
|
|
|
|
|
|
) |
311
|
|
|
|
|
|
|
{ |
312
|
1
|
|
|
|
|
7
|
return ($counter > 1); |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
|
316
|
19
|
|
66
|
|
|
53
|
while ( |
317
|
|
|
|
|
|
|
($i < $this->getSize) |
318
|
|
|
|
|
|
|
&& |
319
|
|
|
|
|
|
|
($this->getIndex($i) < $other_index->getIndex($j)) |
320
|
|
|
|
|
|
|
) |
321
|
|
|
|
|
|
|
{ |
322
|
4
|
|
|
|
|
10
|
$i++; |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
|
325
|
19
|
50
|
33
|
|
|
53
|
if( |
326
|
|
|
|
|
|
|
($i >= $this->getSize) |
327
|
|
|
|
|
|
|
|| |
328
|
|
|
|
|
|
|
($j >= $other_index->getSize) |
329
|
|
|
|
|
|
|
) |
330
|
|
|
|
|
|
|
{ |
331
|
0
|
|
|
|
|
0
|
return ($counter > 1); |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
|
335
|
19
|
|
100
|
|
|
52
|
while ( |
336
|
|
|
|
|
|
|
($j < $other_index->getSize) |
337
|
|
|
|
|
|
|
&& |
338
|
|
|
|
|
|
|
($other_index->getIndex($j) < $this->getIndex($i)) |
339
|
|
|
|
|
|
|
) |
340
|
|
|
|
|
|
|
{ |
341
|
19
|
|
|
|
|
45
|
$j++; |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
|
345
|
19
|
100
|
66
|
|
|
53
|
if( |
346
|
|
|
|
|
|
|
($i >= $this->getSize) |
347
|
|
|
|
|
|
|
|| |
348
|
|
|
|
|
|
|
($j >= $other_index->getSize) |
349
|
|
|
|
|
|
|
) |
350
|
|
|
|
|
|
|
{ |
351
|
10
|
|
|
|
|
62
|
return ($counter > 1); |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
} |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
} |
356
|
9
|
|
|
|
|
39
|
return 0; |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
sub searchSubIndexes |
362
|
|
|
|
|
|
|
{ |
363
|
2717
|
|
|
2717
|
1
|
4962
|
my ($this,$i,$words_a,$size,$chunking_data,$tag_set) = @_; |
364
|
2717
|
|
|
|
|
3676
|
my $j; |
365
|
2717
|
|
|
|
|
3936
|
my $previous = -1; |
366
|
2717
|
|
|
|
|
5129
|
my $sub_index = Lingua::YaTeA::IndexSet->new; |
367
|
2717
|
|
|
|
|
5947
|
for ($j =1; $j <= $size ; $j++) |
368
|
|
|
|
|
|
|
{ |
369
|
|
|
|
|
|
|
|
370
|
21215
|
100
|
|
|
|
48378
|
if ($i&(2**($j-1))) |
371
|
|
|
|
|
|
|
{ |
372
|
10670
|
100
|
100
|
|
|
34063
|
if ( |
|
|
|
100
|
|
|
|
|
373
|
|
|
|
|
|
|
( |
374
|
|
|
|
|
|
|
($previous == -1) |
375
|
|
|
|
|
|
|
&& |
376
|
|
|
|
|
|
|
($words_a->[$j-1]->isCleaningFrontier($chunking_data)) |
377
|
|
|
|
|
|
|
) |
378
|
|
|
|
|
|
|
|| |
379
|
|
|
|
|
|
|
($previous != -1) |
380
|
|
|
|
|
|
|
) |
381
|
|
|
|
|
|
|
{ |
382
|
10178
|
|
|
|
|
14354
|
$previous = $j; |
383
|
|
|
|
|
|
|
# push @sub_indexes, $indexes_a->[$j-1]; |
384
|
10178
|
|
|
|
|
18883
|
$sub_index->addIndex($this->getIndex($j-1)); |
385
|
|
|
|
|
|
|
} |
386
|
|
|
|
|
|
|
else |
387
|
|
|
|
|
|
|
{ |
388
|
492
|
|
|
|
|
933
|
last; |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
} |
392
|
2717
|
100
|
|
|
|
4978
|
if($sub_index->getSize > 1) |
393
|
|
|
|
|
|
|
{ |
394
|
2124
|
100
|
100
|
|
|
3785
|
if( |
|
|
|
100
|
|
|
|
|
395
|
|
|
|
|
|
|
($sub_index->getSize < $this->getSize) |
396
|
|
|
|
|
|
|
&& |
397
|
|
|
|
|
|
|
($words_a->[$sub_index->getLast]->isCleaningFrontier($chunking_data)) |
398
|
|
|
|
|
|
|
&& |
399
|
|
|
|
|
|
|
($sub_index->testSyntacticBreakAndRepetition($words_a,$tag_set)) |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
) |
402
|
|
|
|
|
|
|
{ |
403
|
277
|
|
|
|
|
732
|
return $sub_index; |
404
|
|
|
|
|
|
|
} |
405
|
|
|
|
|
|
|
} |
406
|
|
|
|
|
|
|
} |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
sub testSyntacticBreakAndRepetition |
410
|
|
|
|
|
|
|
{ |
411
|
1815
|
|
|
1815
|
1
|
3362
|
my ($this,$words_a,$tag_set) = @_; |
412
|
1815
|
|
|
|
|
3714
|
my @absent; |
413
|
|
|
|
|
|
|
my $i; |
414
|
1815
|
|
|
|
|
0
|
my %words; |
415
|
1815
|
|
|
|
|
3477
|
my $j = $this->getFirst; |
416
|
|
|
|
|
|
|
|
417
|
1815
|
|
|
|
|
4120
|
for($i = 1; $i < $this->getSize; $i++) |
418
|
|
|
|
|
|
|
{ |
419
|
4381
|
|
|
|
|
10155
|
$words{$words_a->[$j]->getLF}++; |
420
|
|
|
|
|
|
|
|
421
|
4381
|
100
|
|
|
|
8215
|
if($this->getIndex($i) != ($j+1)) |
422
|
|
|
|
|
|
|
{ |
423
|
2637
|
|
|
|
|
5185
|
while(($j+1) < $this->getIndex($i)) |
424
|
|
|
|
|
|
|
{ |
425
|
3593
|
100
|
|
|
|
8879
|
if($tag_set->existTag('PREPOSITIONS',$words_a->[($j+1)]->getIF)) # XXX TH 07/01/2008 |
426
|
|
|
|
|
|
|
{ |
427
|
1538
|
|
|
|
|
9555
|
return; |
428
|
|
|
|
|
|
|
} |
429
|
2055
|
100
|
|
|
|
4996
|
if($tag_set->existTag('CANDIDATES',$words_a->[($j+1)]->getPOS)) |
430
|
|
|
|
|
|
|
{ |
431
|
1821
|
50
|
|
|
|
4054
|
if (exists $words{$words_a->[($j+1)]->getLF}) |
432
|
|
|
|
|
|
|
{ |
433
|
0
|
|
|
|
|
0
|
return; |
434
|
|
|
|
|
|
|
} |
435
|
|
|
|
|
|
|
} |
436
|
|
|
|
|
|
|
|
437
|
2055
|
|
|
|
|
4533
|
$j++; |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
else |
441
|
|
|
|
|
|
|
{ |
442
|
1744
|
|
|
|
|
3461
|
$j++; |
443
|
|
|
|
|
|
|
} |
444
|
|
|
|
|
|
|
} |
445
|
277
|
|
|
|
|
1113
|
return 1; |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
} |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
sub testSyntacticBreak |
451
|
|
|
|
|
|
|
{ |
452
|
0
|
|
|
0
|
0
|
0
|
my ($this,$words_a,$tag_set) = @_; |
453
|
0
|
|
|
|
|
0
|
my @absent; |
454
|
|
|
|
|
|
|
my $i; |
455
|
0
|
|
|
|
|
0
|
my %words; |
456
|
0
|
|
|
|
|
0
|
my $j = $this->getFirst; |
457
|
|
|
|
|
|
|
|
458
|
0
|
|
|
|
|
0
|
for($i = 1; $i < $this->getSize; $i++) |
459
|
|
|
|
|
|
|
{ |
460
|
0
|
|
|
|
|
0
|
$words{$words_a->[$j]->getLF}++; |
461
|
|
|
|
|
|
|
|
462
|
0
|
0
|
|
|
|
0
|
if($this->getIndex($i) != ($j+1)) |
463
|
|
|
|
|
|
|
{ |
464
|
0
|
|
|
|
|
0
|
while(($j+1) < $this->getIndex($i)) |
465
|
|
|
|
|
|
|
{ |
466
|
0
|
0
|
|
|
|
0
|
if($tag_set->existTag('PREPOSITIONS',$words_a->[($j+1)]->getIF)) # XXX TH 07/01/2008 |
467
|
|
|
|
|
|
|
{ |
468
|
0
|
|
|
|
|
0
|
return; |
469
|
|
|
|
|
|
|
} |
470
|
0
|
0
|
|
|
|
0
|
if($tag_set->existTag('CANDIDATES',$words_a->[($j+1)]->getPOS)) |
471
|
|
|
|
|
|
|
{ |
472
|
0
|
0
|
|
|
|
0
|
if (exists $words{$words_a->[($j+1)]->getLF}) |
473
|
|
|
|
|
|
|
{ |
474
|
0
|
|
|
|
|
0
|
return; |
475
|
|
|
|
|
|
|
} |
476
|
|
|
|
|
|
|
} |
477
|
|
|
|
|
|
|
|
478
|
0
|
|
|
|
|
0
|
$j++; |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
} |
481
|
|
|
|
|
|
|
else |
482
|
|
|
|
|
|
|
{ |
483
|
0
|
|
|
|
|
0
|
$j++; |
484
|
|
|
|
|
|
|
} |
485
|
|
|
|
|
|
|
} |
486
|
0
|
|
|
|
|
0
|
return 1; |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
} |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
sub buildIFSequence |
492
|
|
|
|
|
|
|
{ |
493
|
259
|
|
|
259
|
1
|
474
|
my ($this,$words_a) = @_; |
494
|
259
|
|
|
|
|
359
|
my $IF; |
495
|
|
|
|
|
|
|
my $index; |
496
|
259
|
|
|
|
|
403
|
foreach $index (@{$this->getIndexes}) |
|
259
|
|
|
|
|
447
|
|
497
|
|
|
|
|
|
|
{ |
498
|
978
|
|
|
|
|
2027
|
$IF .= $words_a->[$index]->getIF . " "; |
499
|
|
|
|
|
|
|
} |
500
|
259
|
|
|
|
|
463
|
chop $IF; |
501
|
259
|
|
|
|
|
725
|
return $IF; |
502
|
|
|
|
|
|
|
} |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
sub buildPOSSequence |
505
|
|
|
|
|
|
|
{ |
506
|
71
|
|
|
71
|
1
|
172
|
my ($this,$words_a,$tag_set) = @_; |
507
|
71
|
|
|
|
|
119
|
my $POS; |
508
|
|
|
|
|
|
|
my $index; |
509
|
71
|
|
|
|
|
123
|
foreach $index (@{$this->getIndexes}) |
|
71
|
|
|
|
|
140
|
|
510
|
|
|
|
|
|
|
{ |
511
|
270
|
100
|
|
|
|
678
|
if ($tag_set->existTag('PREPOSITIONS',$words_a->[$index]->getIF)) # XXX TH 07/01/2008 |
512
|
|
|
|
|
|
|
{ |
513
|
41
|
|
|
|
|
119
|
$POS .= $words_a->[$index]->getLF . " "; |
514
|
|
|
|
|
|
|
} |
515
|
|
|
|
|
|
|
else |
516
|
|
|
|
|
|
|
{ |
517
|
229
|
|
|
|
|
546
|
$POS .= $words_a->[$index]->getPOS . " "; |
518
|
|
|
|
|
|
|
} |
519
|
|
|
|
|
|
|
} |
520
|
71
|
|
|
|
|
174
|
chop $POS; |
521
|
71
|
|
|
|
|
208
|
return $POS; |
522
|
|
|
|
|
|
|
} |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
sub buildLFSequence |
525
|
|
|
|
|
|
|
{ |
526
|
260
|
|
|
260
|
1
|
474
|
my ($this,$words_a) = @_; |
527
|
260
|
|
|
|
|
376
|
my $LF; |
528
|
|
|
|
|
|
|
my $index; |
529
|
260
|
|
|
|
|
373
|
foreach $index (@{$this->getIndexes}) |
|
260
|
|
|
|
|
449
|
|
530
|
|
|
|
|
|
|
{ |
531
|
987
|
|
|
|
|
1984
|
$LF .= $words_a->[$index]->getLF . " "; |
532
|
|
|
|
|
|
|
} |
533
|
260
|
|
|
|
|
459
|
chop $LF; |
534
|
260
|
|
|
|
|
666
|
return $LF; |
535
|
|
|
|
|
|
|
} |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
sub buildLinguisticKey |
538
|
|
|
|
|
|
|
{ |
539
|
0
|
|
|
0
|
1
|
0
|
my ($this,$words_a,$tag_set) = @_; |
540
|
0
|
|
|
|
|
0
|
my $key = $this->buildIFSequence($words_a) . "~" . $this->buildPOSSequence($words_a,$tag_set) . "~" . $this->buildLFSequence($words_a); |
541
|
0
|
|
|
|
|
0
|
return $key; |
542
|
|
|
|
|
|
|
} |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
sub chooseBestSource |
545
|
|
|
|
|
|
|
{ |
546
|
6
|
|
|
6
|
1
|
27
|
my ($this,$source_a,$words_a,$tag_set) = @_; |
547
|
6
|
50
|
|
|
|
28
|
if(scalar @$source_a > 1) |
548
|
|
|
|
|
|
|
{ |
549
|
0
|
|
|
|
|
0
|
@$source_a = sort ({$this->sortIslands($a,$b,$words_a,$tag_set)} @$source_a); |
|
0
|
|
|
|
|
0
|
|
550
|
|
|
|
|
|
|
} |
551
|
6
|
|
|
|
|
23
|
return $source_a->[0]; |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
sub sortIslands |
555
|
|
|
|
|
|
|
{ |
556
|
0
|
|
|
0
|
1
|
0
|
my ($this,$a,$b,($words_a,$tag_set)) = @_; |
557
|
0
|
0
|
|
|
|
0
|
if($a->getPOS eq $b->getPOS){ # both POS are the same |
558
|
0
|
|
|
|
|
0
|
return 0; |
559
|
|
|
|
|
|
|
} |
560
|
0
|
0
|
|
|
|
0
|
if($a->getPOS eq $this->buildPOSSequence($words_a,$tag_set)){ |
561
|
0
|
|
|
|
|
0
|
return -1; |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
} |
564
|
0
|
0
|
|
|
|
0
|
if($b->getPOS eq $this->buildPOSSequence($words_a,$tag_set)){ |
565
|
0
|
|
|
|
|
0
|
return 1; |
566
|
|
|
|
|
|
|
} |
567
|
0
|
|
|
|
|
0
|
return 0; # both POS are different and different from the wanted POS |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
} |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
sub joinAll |
572
|
|
|
|
|
|
|
{ |
573
|
168
|
|
|
168
|
1
|
318
|
my ($this,$joint) = @_; |
574
|
168
|
|
|
|
|
253
|
return (join ($joint, @{$this->getIndexes})); |
|
168
|
|
|
|
|
278
|
|
575
|
|
|
|
|
|
|
} |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
sub fill |
578
|
|
|
|
|
|
|
{ |
579
|
123
|
|
|
123
|
1
|
238
|
my ($this,$words_a) = @_; |
580
|
123
|
|
|
|
|
201
|
my $i = 0; |
581
|
|
|
|
|
|
|
|
582
|
123
|
|
|
|
|
301
|
while ($i < scalar @$words_a) |
583
|
|
|
|
|
|
|
{ |
584
|
288
|
|
|
|
|
407
|
push @{$this->getIndexes}, $i++; |
|
288
|
|
|
|
|
499
|
|
585
|
|
|
|
|
|
|
} |
586
|
|
|
|
|
|
|
} |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
sub getSize |
589
|
|
|
|
|
|
|
{ |
590
|
14774
|
|
|
14774
|
1
|
24518
|
my ($this) = @_; |
591
|
14774
|
|
|
|
|
18542
|
return scalar @{$this->getIndexes}; |
|
14774
|
|
|
|
|
22698
|
|
592
|
|
|
|
|
|
|
} |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
sub addIndex |
595
|
|
|
|
|
|
|
{ |
596
|
11405
|
|
|
11405
|
1
|
18903
|
my ($this,$index) = @_; |
597
|
11405
|
|
|
|
|
14848
|
push @{$this->getIndexes}, $index; |
|
11405
|
|
|
|
|
17327
|
|
598
|
11405
|
|
|
|
|
16615
|
@{$this->getIndexes}= sort ({$a <=> $b} @{$this->getIndexes}); |
|
11405
|
|
|
|
|
18529
|
|
|
38924
|
|
|
|
|
54716
|
|
|
11405
|
|
|
|
|
17157
|
|
599
|
|
|
|
|
|
|
} |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
sub getPartial |
602
|
|
|
|
|
|
|
{ |
603
|
64
|
|
|
64
|
1
|
184
|
my ($this,$length,$position) = @_; |
604
|
64
|
|
|
|
|
114
|
my $i; |
605
|
64
|
|
|
|
|
195
|
my $partial = Lingua::YaTeA::IndexSet->new; |
606
|
|
|
|
|
|
|
|
607
|
64
|
50
|
|
|
|
209
|
if($position eq "LEFT") |
608
|
|
|
|
|
|
|
{ |
609
|
0
|
|
|
|
|
0
|
for ($i = 0; $i < $length; $i++) |
610
|
|
|
|
|
|
|
{ |
611
|
0
|
|
|
|
|
0
|
$partial->addIndex($this->getIndex($i)); |
612
|
|
|
|
|
|
|
} |
613
|
|
|
|
|
|
|
} |
614
|
64
|
50
|
|
|
|
191
|
if($position eq "RIGHT") |
615
|
|
|
|
|
|
|
{ |
616
|
64
|
|
|
|
|
134
|
for ($i = (scalar @{$this->getIndexes} - $length); $i < scalar @{$this->getIndexes}; $i++){ |
|
64
|
|
|
|
|
176
|
|
|
218
|
|
|
|
|
404
|
|
617
|
154
|
|
|
|
|
312
|
$partial->addIndex($this->getIndex($i)); |
618
|
|
|
|
|
|
|
} |
619
|
|
|
|
|
|
|
} |
620
|
|
|
|
|
|
|
|
621
|
64
|
|
|
|
|
287
|
return $partial; |
622
|
|
|
|
|
|
|
} |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
sub simplify |
625
|
|
|
|
|
|
|
{ |
626
|
89
|
|
|
89
|
1
|
237
|
my ($this,$partial_index_set,$node_set,$tree,$pivot,$fh) = @_; |
627
|
89
|
|
|
|
|
129
|
my $i; |
628
|
89
|
|
|
|
|
170
|
my $j=0; |
629
|
89
|
|
|
|
|
269
|
my $index; |
630
|
|
|
|
|
|
|
my $index_partial; |
631
|
89
|
|
|
|
|
0
|
my @simplified; |
632
|
89
|
100
|
|
|
|
236
|
if(defined $fh) |
633
|
|
|
|
|
|
|
{ |
634
|
|
|
|
|
|
|
# print $fh "arbre:"; |
635
|
|
|
|
|
|
|
# $tree->getIndexSet->print($fh); |
636
|
|
|
|
|
|
|
# print $fh "\nsimplifie:"; |
637
|
|
|
|
|
|
|
# $this->print($fh); |
638
|
|
|
|
|
|
|
# print $fh "\npartial:"; |
639
|
|
|
|
|
|
|
# $partial_index_set->print($fh); |
640
|
|
|
|
|
|
|
# if(defined $pivot) |
641
|
|
|
|
|
|
|
# { |
642
|
|
|
|
|
|
|
# print $fh "\n"; |
643
|
|
|
|
|
|
|
# print $fh "pivot :" .$pivot ."\n"; |
644
|
|
|
|
|
|
|
# } |
645
|
|
|
|
|
|
|
} |
646
|
89
|
|
|
|
|
195
|
for ($i= 0; $i < scalar @{$this->getIndexes}; $i++) |
|
414
|
|
|
|
|
735
|
|
647
|
|
|
|
|
|
|
{ |
648
|
325
|
|
|
|
|
611
|
$index = $this->getIndex($i); |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
# if(defined $fh) |
651
|
|
|
|
|
|
|
# { |
652
|
|
|
|
|
|
|
# print $fh "index :" . $index . "\n"; |
653
|
|
|
|
|
|
|
# } |
654
|
325
|
100
|
|
|
|
492
|
if($j < scalar @{$partial_index_set->getIndexes}) |
|
325
|
|
|
|
|
583
|
|
655
|
|
|
|
|
|
|
{ |
656
|
310
|
|
|
|
|
702
|
&simplifyByCurrent(\$j,\@simplified,$index,$partial_index_set,$node_set,$tree,$pivot,$fh); |
657
|
|
|
|
|
|
|
} |
658
|
|
|
|
|
|
|
else |
659
|
|
|
|
|
|
|
{ |
660
|
|
|
|
|
|
|
# if(defined $fh) |
661
|
|
|
|
|
|
|
# { |
662
|
|
|
|
|
|
|
# print $fh "push2 dans simplified " . $index . "\n"; |
663
|
|
|
|
|
|
|
# } |
664
|
15
|
|
|
|
|
31
|
push @simplified, $index; |
665
|
|
|
|
|
|
|
} |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
} |
668
|
89
|
|
|
|
|
199
|
@{$this->getIndexes} = @simplified; |
|
89
|
|
|
|
|
174
|
|
669
|
|
|
|
|
|
|
# if(defined $fh) |
670
|
|
|
|
|
|
|
# { |
671
|
|
|
|
|
|
|
# print $fh "apres\n"; |
672
|
|
|
|
|
|
|
# print $fh "arbre:"; |
673
|
|
|
|
|
|
|
# $tree->getIndexSet->print($fh); |
674
|
|
|
|
|
|
|
# print $fh "\nsimplifie:"; |
675
|
|
|
|
|
|
|
# $this->print($fh); |
676
|
|
|
|
|
|
|
# print $fh "\npartial:"; |
677
|
|
|
|
|
|
|
# $partial_index_set->print($fh); |
678
|
|
|
|
|
|
|
# print $fh "\n"; |
679
|
|
|
|
|
|
|
# } |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
} |
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
sub simplifyByCurrent |
685
|
|
|
|
|
|
|
{ |
686
|
310
|
|
|
310
|
0
|
677
|
my ($j_s,$simplified_a,$index,$partial_index_set,$node_set,$tree,$pivot,$fh) = @_; |
687
|
310
|
|
|
|
|
554
|
my $index_partial = $partial_index_set->getIndex($$j_s); |
688
|
310
|
|
33
|
|
|
811
|
while ( |
|
|
|
33
|
|
|
|
|
689
|
|
|
|
|
|
|
($index_partial < $index) |
690
|
|
|
|
|
|
|
&& |
691
|
|
|
|
|
|
|
($tree->getIndexSet->indexExists($index_partial)) |
692
|
|
|
|
|
|
|
&& |
693
|
0
|
|
|
|
|
0
|
($$j_s < scalar @{$partial_index_set->getIndexes} -1) |
694
|
|
|
|
|
|
|
) |
695
|
|
|
|
|
|
|
{ |
696
|
0
|
|
|
|
|
0
|
$$j_s++; |
697
|
0
|
|
|
|
|
0
|
$index_partial = $partial_index_set->getIndex($$j_s); |
698
|
|
|
|
|
|
|
} |
699
|
|
|
|
|
|
|
# if(defined $fh) |
700
|
|
|
|
|
|
|
# { |
701
|
|
|
|
|
|
|
# print $fh "\tindex partiel :" . $index_partial . "\n"; |
702
|
|
|
|
|
|
|
# } |
703
|
|
|
|
|
|
|
|
704
|
310
|
100
|
|
|
|
570
|
if($index == $index_partial) |
705
|
|
|
|
|
|
|
{ |
706
|
208
|
100
|
100
|
|
|
1026
|
if( |
|
|
|
100
|
|
|
|
|
707
|
|
|
|
|
|
|
( |
708
|
|
|
|
|
|
|
(!defined $pivot) |
709
|
|
|
|
|
|
|
|| |
710
|
|
|
|
|
|
|
($index != $pivot) |
711
|
|
|
|
|
|
|
) |
712
|
|
|
|
|
|
|
&& |
713
|
|
|
|
|
|
|
(! $tree->getIndexSet->indexExists($index)) |
714
|
|
|
|
|
|
|
) |
715
|
|
|
|
|
|
|
{ |
716
|
144
|
|
|
|
|
382
|
$tree->getIndexSet->addIndex($index); |
717
|
|
|
|
|
|
|
# if(defined $fh) |
718
|
|
|
|
|
|
|
# { |
719
|
|
|
|
|
|
|
# print $fh "ajoute a iindex d'arbre :" . $index . "\n"; |
720
|
|
|
|
|
|
|
# } |
721
|
|
|
|
|
|
|
} |
722
|
|
|
|
|
|
|
# hack from TH |
723
|
208
|
|
|
|
|
588
|
my $head = $node_set->getRoot->searchHead(0); |
724
|
208
|
50
|
33
|
|
|
786
|
if((ref($head) ne "SCALAR") && (defined $head)) { |
725
|
208
|
100
|
|
|
|
481
|
if ($index_partial == $head->getIndex) |
726
|
|
|
|
|
|
|
{ |
727
|
89
|
|
|
|
|
167
|
push @$simplified_a, $index_partial; |
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
} |
730
|
|
|
|
|
|
|
} else { |
731
|
0
|
|
|
|
|
0
|
warn "The head is undefined\n"; |
732
|
0
|
|
|
|
|
0
|
return(-1); |
733
|
|
|
|
|
|
|
} |
734
|
|
|
|
|
|
|
|
735
|
208
|
|
|
|
|
530
|
$$j_s++; |
736
|
|
|
|
|
|
|
# if(defined $fh) |
737
|
|
|
|
|
|
|
# { |
738
|
|
|
|
|
|
|
# print $fh "incerementation j" . $$j_s . "\n"; |
739
|
|
|
|
|
|
|
# } |
740
|
|
|
|
|
|
|
} |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
else |
743
|
|
|
|
|
|
|
{ |
744
|
|
|
|
|
|
|
# if(defined $fh) |
745
|
|
|
|
|
|
|
# { |
746
|
|
|
|
|
|
|
# print $fh "push dans simplified " . $index . "\n"; |
747
|
|
|
|
|
|
|
# } |
748
|
102
|
|
|
|
|
250
|
push @$simplified_a, $index; |
749
|
|
|
|
|
|
|
} |
750
|
|
|
|
|
|
|
} |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
sub simplifyWithSeveralPivots |
754
|
|
|
|
|
|
|
{ |
755
|
0
|
|
|
0
|
1
|
0
|
my ($this,$partial_index_set,$node_set,$tree,$pivots_h) = @_; |
756
|
0
|
|
|
|
|
0
|
my $i; |
757
|
0
|
|
|
|
|
0
|
my $j=0; |
758
|
0
|
|
|
|
|
0
|
my $index; |
759
|
|
|
|
|
|
|
my $index_partial; |
760
|
0
|
|
|
|
|
0
|
my @simplified; |
761
|
|
|
|
|
|
|
|
762
|
0
|
|
|
|
|
0
|
for ($i= 0; $i < scalar @{$this->getIndexes}; $i++) |
|
0
|
|
|
|
|
0
|
|
763
|
|
|
|
|
|
|
{ |
764
|
0
|
|
|
|
|
0
|
$index = $this->getIndex($i); |
765
|
|
|
|
|
|
|
|
766
|
0
|
0
|
|
|
|
0
|
if($j < scalar @{$partial_index_set->getIndexes}) |
|
0
|
|
|
|
|
0
|
|
767
|
|
|
|
|
|
|
{ |
768
|
0
|
|
|
|
|
0
|
$index_partial = $partial_index_set->getIndex($j); |
769
|
|
|
|
|
|
|
|
770
|
0
|
0
|
|
|
|
0
|
if($index == $index_partial) |
771
|
|
|
|
|
|
|
{ |
772
|
0
|
0
|
|
|
|
0
|
if(exists $pivots_h->{$index}) |
773
|
|
|
|
|
|
|
{ |
774
|
0
|
|
|
|
|
0
|
push @simplified, $index_partial; |
775
|
|
|
|
|
|
|
} |
776
|
0
|
|
|
|
|
0
|
$j++; |
777
|
|
|
|
|
|
|
} |
778
|
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
else |
780
|
|
|
|
|
|
|
{ |
781
|
0
|
|
|
|
|
0
|
push @simplified, $index; |
782
|
|
|
|
|
|
|
} |
783
|
|
|
|
|
|
|
} |
784
|
|
|
|
|
|
|
else |
785
|
|
|
|
|
|
|
{ |
786
|
0
|
|
|
|
|
0
|
push @simplified, $index; |
787
|
|
|
|
|
|
|
} |
788
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
} |
790
|
0
|
|
|
|
|
0
|
@{$this->getIndexes} = @simplified; |
|
0
|
|
|
|
|
0
|
|
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
} |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
sub searchPivot |
796
|
|
|
|
|
|
|
{ |
797
|
22
|
|
|
22
|
1
|
70
|
my ($this,$other_set) = @_; |
798
|
22
|
|
|
|
|
54
|
my $i; |
799
|
|
|
|
|
|
|
my $j; |
800
|
|
|
|
|
|
|
|
801
|
22
|
|
|
|
|
40
|
foreach $i (@{$this->getIndexes}) |
|
22
|
|
|
|
|
54
|
|
802
|
|
|
|
|
|
|
{ |
803
|
58
|
|
|
|
|
96
|
foreach $j (@{$other_set->getIndexes}) |
|
58
|
|
|
|
|
119
|
|
804
|
|
|
|
|
|
|
{ |
805
|
164
|
100
|
|
|
|
345
|
if ($i == $j) |
806
|
|
|
|
|
|
|
{ |
807
|
19
|
|
|
|
|
74
|
return $i; |
808
|
|
|
|
|
|
|
} |
809
|
|
|
|
|
|
|
} |
810
|
|
|
|
|
|
|
} |
811
|
3
|
|
|
|
|
12
|
return; |
812
|
|
|
|
|
|
|
} |
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
|
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
sub print |
817
|
|
|
|
|
|
|
{ |
818
|
3
|
|
|
3
|
1
|
7
|
my ($this,$fh) = @_; |
819
|
3
|
|
|
|
|
6
|
my $index; |
820
|
3
|
50
|
|
|
|
9
|
if(defined $fh) |
821
|
|
|
|
|
|
|
{ |
822
|
3
|
|
|
|
|
23
|
print $fh (joinAll($this,'-')); |
823
|
|
|
|
|
|
|
} |
824
|
|
|
|
|
|
|
else |
825
|
|
|
|
|
|
|
{ |
826
|
0
|
|
|
|
|
0
|
print joinAll(($this,'-')); |
827
|
|
|
|
|
|
|
} |
828
|
|
|
|
|
|
|
} |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
sub mergeWith |
831
|
|
|
|
|
|
|
{ |
832
|
48
|
|
|
48
|
1
|
82
|
my ($this,$index_set_to_add) = @_; |
833
|
48
|
|
|
|
|
75
|
my $index; |
834
|
48
|
|
|
|
|
65
|
push @{$this->getIndexes},@{$index_set_to_add->getIndexes}; |
|
48
|
|
|
|
|
97
|
|
|
48
|
|
|
|
|
95
|
|
835
|
48
|
|
|
|
|
85
|
@{$this->getIndexes}= sort ({$a <=> $b} @{$this->getIndexes}); |
|
48
|
|
|
|
|
84
|
|
|
290
|
|
|
|
|
460
|
|
|
48
|
|
|
|
|
84
|
|
836
|
|
|
|
|
|
|
} |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
sub contains |
840
|
|
|
|
|
|
|
{ |
841
|
30
|
|
|
30
|
1
|
54
|
my ($this,$other_index) = @_; |
842
|
|
|
|
|
|
|
|
843
|
30
|
100
|
66
|
|
|
76
|
if( |
844
|
|
|
|
|
|
|
($this->getFirst <= $other_index->getFirst) |
845
|
|
|
|
|
|
|
&& |
846
|
|
|
|
|
|
|
($this->getLast >= $other_index->getLast) |
847
|
|
|
|
|
|
|
) |
848
|
|
|
|
|
|
|
{ |
849
|
24
|
|
|
|
|
90
|
return 1; |
850
|
|
|
|
|
|
|
} |
851
|
6
|
|
|
|
|
29
|
return 0; |
852
|
|
|
|
|
|
|
} |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
sub indexExists |
855
|
|
|
|
|
|
|
{ |
856
|
196
|
|
|
196
|
1
|
397
|
my ($this,$index) = @_; |
857
|
196
|
|
|
|
|
361
|
my %this_index = map ({ $_ => 1 } @{$this->getIndexes}); |
|
617
|
|
|
|
|
1522
|
|
|
196
|
|
|
|
|
345
|
|
858
|
196
|
100
|
|
|
|
560
|
if(exists $this_index{$index}) |
859
|
|
|
|
|
|
|
{ |
860
|
30
|
|
|
|
|
136
|
return 1; |
861
|
|
|
|
|
|
|
} |
862
|
166
|
|
|
|
|
624
|
return 0; |
863
|
|
|
|
|
|
|
} |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
sub getIncludedContext |
866
|
|
|
|
|
|
|
{ |
867
|
1
|
|
|
1
|
1
|
6
|
my ($this,$included) = @_; |
868
|
1
|
|
|
|
|
6
|
my $left_context = $this->findPrevious($included->getFirst); |
869
|
1
|
|
|
|
|
5
|
my $right_context = $this->findNext($included->getLast); |
870
|
|
|
|
|
|
|
|
871
|
1
|
|
|
|
|
4
|
return ($left_context,$right_context); |
872
|
|
|
|
|
|
|
} |
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
sub findPrevious |
875
|
|
|
|
|
|
|
{ |
876
|
1
|
|
|
1
|
1
|
3
|
my ($this,$stop_index) = @_; |
877
|
1
|
|
|
|
|
3
|
my $previous = -1; |
878
|
1
|
|
|
|
|
2
|
my $index; |
879
|
1
|
|
|
|
|
2
|
foreach $index (@{$this->getIndexes}) |
|
1
|
|
|
|
|
3
|
|
880
|
|
|
|
|
|
|
{ |
881
|
5
|
100
|
|
|
|
10
|
if($index >= $stop_index) |
882
|
|
|
|
|
|
|
{ |
883
|
1
|
|
|
|
|
4
|
return $previous; |
884
|
|
|
|
|
|
|
} |
885
|
4
|
|
|
|
|
9
|
$previous = $index; |
886
|
|
|
|
|
|
|
} |
887
|
0
|
|
|
|
|
0
|
return -1; |
888
|
|
|
|
|
|
|
} |
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
sub findNext |
891
|
|
|
|
|
|
|
{ |
892
|
1
|
|
|
1
|
1
|
3
|
my ($this,$stop_index) = @_; |
893
|
1
|
|
|
|
|
3
|
my $index; |
894
|
1
|
|
|
|
|
2
|
foreach $index (@{$this->getIndexes}) |
|
1
|
|
|
|
|
10
|
|
895
|
|
|
|
|
|
|
{ |
896
|
5
|
50
|
|
|
|
11
|
if($index > $stop_index) |
897
|
|
|
|
|
|
|
{ |
898
|
0
|
|
|
|
|
0
|
return $index; |
899
|
|
|
|
|
|
|
} |
900
|
|
|
|
|
|
|
} |
901
|
1
|
|
|
|
|
4
|
return -1; |
902
|
|
|
|
|
|
|
} |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
sub removeIndex |
905
|
|
|
|
|
|
|
{ |
906
|
0
|
|
|
0
|
1
|
0
|
my ($this,$index_to_remove) = @_; |
907
|
0
|
|
|
|
|
0
|
my @tmp; |
908
|
|
|
|
|
|
|
my $index; |
909
|
0
|
|
|
|
|
0
|
foreach $index (@{$this->getIndexes}) |
|
0
|
|
|
|
|
0
|
|
910
|
|
|
|
|
|
|
{ |
911
|
0
|
0
|
|
|
|
0
|
if($index != $index_to_remove) |
912
|
|
|
|
|
|
|
{ |
913
|
0
|
|
|
|
|
0
|
push @tmp, $index; |
914
|
|
|
|
|
|
|
} |
915
|
|
|
|
|
|
|
} |
916
|
0
|
|
|
|
|
0
|
@{$this->getIndexes} = @tmp; |
|
0
|
|
|
|
|
0
|
|
917
|
|
|
|
|
|
|
} |
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
sub defineAppendMode |
921
|
|
|
|
|
|
|
{ |
922
|
52
|
|
|
52
|
1
|
138
|
my ($this,$to_append,$pivot,$fh) = @_; |
923
|
52
|
|
|
|
|
104
|
my $mode; |
924
|
|
|
|
|
|
|
# if(defined $fh) |
925
|
|
|
|
|
|
|
# { |
926
|
|
|
|
|
|
|
# print $fh "-> this\n"; |
927
|
|
|
|
|
|
|
# print $fh $this->getFirst . "\n"; |
928
|
|
|
|
|
|
|
# print $fh $this->getLast . "\n"; |
929
|
|
|
|
|
|
|
# print $fh "-> to append\n"; |
930
|
|
|
|
|
|
|
# print $fh $to_append->getFirst . "\n"; |
931
|
|
|
|
|
|
|
# print $fh $to_append->getLast . "\n"; |
932
|
|
|
|
|
|
|
# } |
933
|
|
|
|
|
|
|
|
934
|
52
|
50
|
|
|
|
87
|
if (scalar(@{$this->getIndexes}) > 0) { |
|
52
|
|
|
|
|
130
|
|
935
|
52
|
100
|
66
|
|
|
120
|
if( |
936
|
|
|
|
|
|
|
($this->getLast < $to_append->getFirst) |
937
|
|
|
|
|
|
|
|| |
938
|
|
|
|
|
|
|
($this->getFirst > $to_append->getLast) |
939
|
|
|
|
|
|
|
) |
940
|
|
|
|
|
|
|
{ |
941
|
|
|
|
|
|
|
# if(defined $fh) |
942
|
|
|
|
|
|
|
# { |
943
|
|
|
|
|
|
|
# print $fh "dis 1 \n"; |
944
|
|
|
|
|
|
|
# } |
945
|
3
|
|
|
|
|
12
|
return "DISJUNCTION"; # external disjunction |
946
|
|
|
|
|
|
|
} |
947
|
|
|
|
|
|
|
|
948
|
49
|
100
|
100
|
|
|
124
|
if( |
949
|
|
|
|
|
|
|
($this->getLast == $to_append->getFirst) |
950
|
|
|
|
|
|
|
|| |
951
|
|
|
|
|
|
|
($this->getFirst == $to_append->getLast) |
952
|
|
|
|
|
|
|
) |
953
|
|
|
|
|
|
|
{ |
954
|
25
|
|
|
|
|
92
|
return "ADJUNCTION"; |
955
|
|
|
|
|
|
|
} |
956
|
|
|
|
|
|
|
|
957
|
24
|
100
|
|
|
|
74
|
if($this->getFirst <= $to_append->getFirst) |
958
|
|
|
|
|
|
|
{ |
959
|
1
|
50
|
|
|
|
3
|
if($this->getLast >= $to_append->getLast) |
960
|
|
|
|
|
|
|
{ |
961
|
1
|
50
|
|
|
|
12
|
if(defined $pivot) |
962
|
|
|
|
|
|
|
{ |
963
|
|
|
|
|
|
|
|
964
|
1
|
|
|
|
|
6
|
return "INCLUSION"; |
965
|
|
|
|
|
|
|
} |
966
|
0
|
0
|
|
|
|
0
|
if(! $this->crosses($to_append)) |
967
|
|
|
|
|
|
|
{ |
968
|
0
|
|
|
|
|
0
|
return "DISJUNCTION"; # internal disjunction |
969
|
|
|
|
|
|
|
} |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
} |
972
|
|
|
|
|
|
|
else |
973
|
|
|
|
|
|
|
{ |
974
|
0
|
0
|
|
|
|
0
|
if($this->getLast < $to_append->getLast) |
975
|
|
|
|
|
|
|
{ |
976
|
0
|
0
|
|
|
|
0
|
if (defined $pivot) |
977
|
|
|
|
|
|
|
{ |
978
|
0
|
0
|
|
|
|
0
|
if($pivot == $this->getLast) |
979
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
{ |
981
|
0
|
|
|
|
|
0
|
return "INCLUSION"; |
982
|
|
|
|
|
|
|
} |
983
|
|
|
|
|
|
|
else |
984
|
|
|
|
|
|
|
{ |
985
|
0
|
|
|
|
|
0
|
return "REVERSED_INCLUSION"; |
986
|
|
|
|
|
|
|
} |
987
|
|
|
|
|
|
|
} |
988
|
|
|
|
|
|
|
} |
989
|
|
|
|
|
|
|
} |
990
|
|
|
|
|
|
|
} |
991
|
23
|
50
|
|
|
|
60
|
if($this->getFirst >= $to_append->getFirst) |
992
|
|
|
|
|
|
|
{ |
993
|
23
|
100
|
|
|
|
55
|
if($this->getLast <= $to_append->getLast) |
994
|
|
|
|
|
|
|
{ |
995
|
19
|
50
|
|
|
|
48
|
if(defined $pivot) |
996
|
|
|
|
|
|
|
{ |
997
|
19
|
|
|
|
|
65
|
return "REVERSED_INCLUSION"; |
998
|
|
|
|
|
|
|
} |
999
|
0
|
0
|
|
|
|
0
|
if(! $this->crosses($to_append)) |
1000
|
|
|
|
|
|
|
{ |
1001
|
0
|
|
|
|
|
0
|
return "DISJUNCTION"; # internal disjunction |
1002
|
|
|
|
|
|
|
} |
1003
|
|
|
|
|
|
|
} |
1004
|
|
|
|
|
|
|
else |
1005
|
|
|
|
|
|
|
{ |
1006
|
4
|
50
|
|
|
|
18
|
if($this->getLast > $to_append->getLast) |
1007
|
|
|
|
|
|
|
{ |
1008
|
4
|
50
|
|
|
|
14
|
if (defined $pivot) |
1009
|
|
|
|
|
|
|
{ |
1010
|
4
|
50
|
|
|
|
14
|
if ($pivot == $this->getFirst) |
1011
|
|
|
|
|
|
|
{ |
1012
|
0
|
|
|
|
|
0
|
return "INCLUSION"; |
1013
|
|
|
|
|
|
|
} |
1014
|
|
|
|
|
|
|
else |
1015
|
|
|
|
|
|
|
{ |
1016
|
4
|
|
|
|
|
14
|
return "REVERSED_INCLUSION"; |
1017
|
|
|
|
|
|
|
} |
1018
|
|
|
|
|
|
|
} |
1019
|
|
|
|
|
|
|
} |
1020
|
|
|
|
|
|
|
} |
1021
|
|
|
|
|
|
|
} |
1022
|
|
|
|
|
|
|
} |
1023
|
0
|
|
|
|
|
0
|
return $mode; |
1024
|
|
|
|
|
|
|
} |
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
sub crosses |
1027
|
|
|
|
|
|
|
{ |
1028
|
0
|
|
|
0
|
1
|
0
|
my ($this,$to_append) = @_; |
1029
|
0
|
|
|
|
|
0
|
my $gaps_a; |
1030
|
|
|
|
|
|
|
my %gaps; |
1031
|
0
|
|
|
|
|
0
|
my $gap_h; |
1032
|
0
|
|
|
|
|
0
|
my $index; |
1033
|
0
|
|
|
|
|
0
|
my @fulled_gaps; |
1034
|
0
|
0
|
0
|
|
|
0
|
if |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
1035
|
|
|
|
|
|
|
( |
1036
|
|
|
|
|
|
|
( |
1037
|
|
|
|
|
|
|
($this->getFirst < $to_append->getFirst) |
1038
|
|
|
|
|
|
|
&& |
1039
|
|
|
|
|
|
|
($this->getLast > $to_append->getFirst) |
1040
|
|
|
|
|
|
|
&& |
1041
|
|
|
|
|
|
|
($this->getLast < $to_append->getLast) |
1042
|
|
|
|
|
|
|
) |
1043
|
|
|
|
|
|
|
|| |
1044
|
|
|
|
|
|
|
( |
1045
|
|
|
|
|
|
|
($this->getFirst > $to_append->getFirst) |
1046
|
|
|
|
|
|
|
&& |
1047
|
|
|
|
|
|
|
($this->getFirst < $to_append->getLast) |
1048
|
|
|
|
|
|
|
&& |
1049
|
|
|
|
|
|
|
($this->getLast > $to_append->getLast) |
1050
|
|
|
|
|
|
|
) |
1051
|
|
|
|
|
|
|
) |
1052
|
|
|
|
|
|
|
{ |
1053
|
0
|
|
|
|
|
0
|
return 1; |
1054
|
|
|
|
|
|
|
} |
1055
|
0
|
|
|
|
|
0
|
$gaps_a = $this->getGaps; |
1056
|
0
|
0
|
|
|
|
0
|
if(scalar @$gaps_a > 1) |
1057
|
|
|
|
|
|
|
{ |
1058
|
0
|
|
|
|
|
0
|
foreach $index (@{$to_append->getIndexes}) |
|
0
|
|
|
|
|
0
|
|
1059
|
|
|
|
|
|
|
{ |
1060
|
0
|
|
|
|
|
0
|
foreach $gap_h (@$gaps_a) |
1061
|
|
|
|
|
|
|
{ |
1062
|
0
|
0
|
|
|
|
0
|
if(exists $gap_h->{$index}) |
1063
|
|
|
|
|
|
|
{ |
1064
|
0
|
|
|
|
|
0
|
$gaps{$gap_h}++; |
1065
|
|
|
|
|
|
|
} |
1066
|
|
|
|
|
|
|
} |
1067
|
|
|
|
|
|
|
} |
1068
|
|
|
|
|
|
|
} |
1069
|
0
|
|
|
|
|
0
|
@fulled_gaps = keys %gaps; |
1070
|
0
|
0
|
|
|
|
0
|
if(scalar @fulled_gaps > 1) |
1071
|
|
|
|
|
|
|
{ |
1072
|
0
|
|
|
|
|
0
|
return 1; |
1073
|
|
|
|
|
|
|
} |
1074
|
0
|
|
|
|
|
0
|
return 0; |
1075
|
|
|
|
|
|
|
} |
1076
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
sub getGaps |
1078
|
|
|
|
|
|
|
{ |
1079
|
64
|
|
|
64
|
1
|
148
|
my ($this) = @_; |
1080
|
64
|
|
|
|
|
107
|
my $index; |
1081
|
|
|
|
|
|
|
my $previous; |
1082
|
64
|
|
|
|
|
110
|
my $counter = 0; |
1083
|
64
|
|
|
|
|
101
|
my @gaps; |
1084
|
|
|
|
|
|
|
|
1085
|
|
|
|
|
|
|
# print STDERR "gG1\n"; |
1086
|
|
|
|
|
|
|
|
1087
|
64
|
|
|
|
|
120
|
foreach $index (@{$this->getIndexes}) |
|
64
|
|
|
|
|
140
|
|
1088
|
|
|
|
|
|
|
{ |
1089
|
|
|
|
|
|
|
# print STDERR "gG2 (index = $index)\n"; |
1090
|
|
|
|
|
|
|
# print STDERR "gG2 (counter = $counter)\n"; |
1091
|
|
|
|
|
|
|
# if (defined $previous) {print STDERR "gG2 (previous = $previous)\n";} |
1092
|
|
|
|
|
|
|
# TH - 25072007 |
1093
|
205
|
100
|
|
|
|
383
|
if (defined $previous) { |
1094
|
|
|
|
|
|
|
|
1095
|
141
|
100
|
|
|
|
306
|
if ($index > $previous+1) { |
1096
|
25
|
|
|
|
|
54
|
my %gap; |
1097
|
25
|
|
|
|
|
47
|
$counter = $previous+1; |
1098
|
|
|
|
|
|
|
# print STDERR "gG3\n"; |
1099
|
25
|
|
|
|
|
79
|
while ($counter != $index) |
1100
|
|
|
|
|
|
|
{ |
1101
|
|
|
|
|
|
|
# print STDERR "gG3 (counter = $counter)\n"; |
1102
|
|
|
|
|
|
|
|
1103
|
35
|
|
|
|
|
201
|
$gap{$counter++} = 0; |
1104
|
|
|
|
|
|
|
} |
1105
|
|
|
|
|
|
|
# print STDERR "gG4\n"; |
1106
|
25
|
|
|
|
|
80
|
push @gaps, \%gap; |
1107
|
|
|
|
|
|
|
} |
1108
|
|
|
|
|
|
|
} |
1109
|
205
|
|
|
|
|
332
|
$previous = $index; |
1110
|
|
|
|
|
|
|
} |
1111
|
|
|
|
|
|
|
# print STDERR "gGF\n"; |
1112
|
|
|
|
|
|
|
|
1113
|
64
|
|
|
|
|
187
|
return \@gaps; |
1114
|
|
|
|
|
|
|
} |
1115
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
sub isDiscontinuous |
1118
|
|
|
|
|
|
|
{ |
1119
|
0
|
|
|
0
|
0
|
|
my ($this) = @_; |
1120
|
0
|
|
|
|
|
|
my $i; |
1121
|
0
|
|
|
|
|
|
for ($i = 1; $i < scalar @{$this->getIndexes}; $i++) |
|
0
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
{ |
1123
|
0
|
0
|
|
|
|
|
if($this->getIndexes->[$i] != $this->getIndexes->[$i-1] +1) |
1124
|
|
|
|
|
|
|
{ |
1125
|
0
|
|
|
|
|
|
return 1; |
1126
|
|
|
|
|
|
|
} |
1127
|
|
|
|
|
|
|
} |
1128
|
0
|
|
|
|
|
|
return 0; |
1129
|
|
|
|
|
|
|
} |
1130
|
|
|
|
|
|
|
|
1131
|
|
|
|
|
|
|
sub removeDoubles |
1132
|
|
|
|
|
|
|
{ |
1133
|
0
|
|
|
0
|
1
|
|
my ($this) = @_; |
1134
|
0
|
|
|
|
|
|
my $index; |
1135
|
|
|
|
|
|
|
my %uniq; |
1136
|
0
|
|
|
|
|
|
my @tmp; |
1137
|
|
|
|
|
|
|
|
1138
|
0
|
|
|
|
|
|
foreach $index (@{$this->getIndexes}) |
|
0
|
|
|
|
|
|
|
1139
|
|
|
|
|
|
|
{ |
1140
|
0
|
0
|
|
|
|
|
if(!exists $uniq{$index}) |
1141
|
|
|
|
|
|
|
{ |
1142
|
0
|
|
|
|
|
|
push @tmp, $index; |
1143
|
|
|
|
|
|
|
} |
1144
|
0
|
|
|
|
|
|
$uniq{$index}++; |
1145
|
|
|
|
|
|
|
} |
1146
|
0
|
|
|
|
|
|
@{$this->getIndexes} = @tmp; |
|
0
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
} |
1148
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
1; |
1150
|
|
|
|
|
|
|
|
1151
|
|
|
|
|
|
|
__END__ |