| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Lingua::Ogmios::Annotations::Phrase; |
|
2
|
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
66
|
use strict; |
|
|
16
|
|
|
|
|
23
|
|
|
|
16
|
|
|
|
|
471
|
|
|
4
|
16
|
|
|
16
|
|
56
|
use warnings; |
|
|
16
|
|
|
|
|
46
|
|
|
|
16
|
|
|
|
|
336
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
16
|
|
|
16
|
|
62
|
use Lingua::Ogmios::Annotations::Element; |
|
|
16
|
|
|
|
|
20
|
|
|
|
16
|
|
|
|
|
17200
|
|
|
7
|
|
|
|
|
|
|
our @ISA = qw(Lingua::Ogmios::Annotations::Element); |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
#
|
|
14
|
|
|
|
|
|
|
# (log_id?, comments*, phrase+) > |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
#
|
|
18
|
|
|
|
|
|
|
# list_refid_components, |
|
19
|
|
|
|
|
|
|
# form?) > |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
#
|
|
23
|
|
|
|
|
|
|
# (refid_word | refid_phrase)+ > |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# |
|
26
|
|
|
|
|
|
|
# |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
|
29
|
0
|
|
|
0
|
0
|
|
my ($class, $fields) = @_; |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my @refTypes = ('refid_phrase', 'refid_word'); |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if (!defined $fields->{'id'}) { |
|
34
|
0
|
|
|
|
|
|
$fields->{'id'} = -1; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
# if (!defined $fields->{'list_refid_components'}) { # list_refid_components |
|
37
|
|
|
|
|
|
|
# die("list_refid_components is not defined"); |
|
38
|
|
|
|
|
|
|
# } |
|
39
|
0
|
|
|
|
|
|
my $phrase = $class->SUPER::new({ |
|
40
|
|
|
|
|
|
|
'id' => $fields->{'id'}, |
|
41
|
|
|
|
|
|
|
# 'form' => $fields->{'form'}, |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
); |
|
44
|
0
|
|
|
|
|
|
bless ($phrase,$class); |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $i = 0; |
|
47
|
0
|
|
|
|
|
|
my $reference_name; |
|
48
|
|
|
|
|
|
|
my $ref; |
|
49
|
0
|
|
|
|
|
|
foreach $ref (@refTypes) { |
|
50
|
0
|
0
|
|
|
|
|
if (defined $fields->{$ref}) { |
|
51
|
0
|
|
|
|
|
|
$reference_name = $ref; |
|
52
|
0
|
|
|
|
|
|
last; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
0
|
|
|
|
|
|
$i++; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
0
|
0
|
|
|
|
|
if ($i == scalar(@refTypes)) { |
|
57
|
0
|
|
|
|
|
|
die("reference (list) is not defined"); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
0
|
|
|
|
|
|
$phrase->list_refid_components($reference_name, $fields->{$reference_name}); |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
if (defined $fields->{'form'}) { |
|
62
|
0
|
|
|
|
|
|
$phrase->setForm($fields->{'form'}); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
0
|
0
|
|
|
|
|
if (defined $fields->{'type'}) { |
|
65
|
0
|
|
|
|
|
|
$phrase->type($fields->{'type'}); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
0
|
0
|
|
|
|
|
if (defined $fields->{'log_id'}) { |
|
68
|
0
|
|
|
|
|
|
$phrase->setLogId($fields->{'log_id'}); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
0
|
|
|
|
|
|
return($phrase); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub list_refid_components { |
|
75
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
76
|
0
|
|
|
|
|
|
my $ref; |
|
77
|
|
|
|
|
|
|
my $elt; |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
0
|
0
|
|
|
|
if ((@_) && (scalar @_ == 2)) { |
|
80
|
0
|
|
|
|
|
|
$self->{'list_refid_components'} = {}; |
|
81
|
0
|
|
|
|
|
|
$self->{'list_refid_components'}->{'reference'} = shift; |
|
82
|
0
|
|
|
|
|
|
$self->{'list_refid_components'}->{$self->{'list_refid_components'}->{'reference'}} = []; |
|
83
|
0
|
|
|
|
|
|
$ref = shift; |
|
84
|
0
|
|
|
|
|
|
foreach $elt (@$ref) { |
|
85
|
0
|
|
|
|
|
|
push @{$self->{'list_refid_components'}->{$self->{'list_refid_components'}->{'reference'}}}, $elt; |
|
|
0
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
} |
|
88
|
0
|
|
|
|
|
|
return($self->{'list_refid_components'}->{$self->{'list_refid_components'}->{'reference'}}); |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub type { |
|
93
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
$self->{'type'} = shift if @_; |
|
96
|
0
|
|
|
|
|
|
return($self->{'type'}); |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub reference { |
|
100
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
101
|
0
|
|
|
|
|
|
my $ref; |
|
102
|
|
|
|
|
|
|
my $elt; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# if ((@_) && (scalar @_ == 2)) { |
|
105
|
|
|
|
|
|
|
# $self->{'reference'} = shift; |
|
106
|
|
|
|
|
|
|
# $self->{$self->{'reference'}} = []; |
|
107
|
|
|
|
|
|
|
# $ref = shift; |
|
108
|
|
|
|
|
|
|
# foreach $elt (@$ref) { |
|
109
|
|
|
|
|
|
|
# push @{$self->{$self->{'reference'}}}, $elt; |
|
110
|
|
|
|
|
|
|
# } |
|
111
|
|
|
|
|
|
|
# } |
|
112
|
0
|
|
|
|
|
|
return($self->{'list_refid_components'}->{$self->reference_name}); |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub reference_name { |
|
117
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
$self->{'list_refid_components'}->{'reference'} = shift if @_; |
|
120
|
0
|
|
|
|
|
|
return $self->{'list_refid_components'}->{'reference'}; |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub getReferenceSize { |
|
125
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
my $token; |
|
128
|
0
|
|
|
|
|
|
my $size = 0; |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# for $element (@{$self->list_refid_components}) { |
|
131
|
|
|
|
|
|
|
# $size += $element->getReferenceSize; |
|
132
|
|
|
|
|
|
|
# } |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
$token = $self->start_token; |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
while(!($token->equals($self->end_token))) { |
|
137
|
0
|
|
|
|
|
|
$size++; |
|
138
|
0
|
|
|
|
|
|
$token = $token->next; |
|
139
|
|
|
|
|
|
|
} |
|
140
|
0
|
|
|
|
|
|
$size++; |
|
141
|
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
return($size); |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub end_token { |
|
148
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# warn $self->reference_name ; |
|
151
|
|
|
|
|
|
|
|
|
152
|
0
|
0
|
|
|
|
|
if ($self->reference_name eq "list_refid_token") { |
|
153
|
0
|
|
|
|
|
|
return($self->reference->[$#{$self->reference}]); |
|
|
0
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
#if list_refid token -> OK |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
# if refid word -> word->start_token |
|
158
|
|
|
|
|
|
|
# OR |
|
159
|
|
|
|
|
|
|
# if refid phrase -> phrase->start_token |
|
160
|
0
|
0
|
0
|
|
|
|
if (($self->reference_name eq "refid_word") || |
|
161
|
|
|
|
|
|
|
($self->reference_name eq "refid_phrase")){ |
|
162
|
0
|
|
|
|
|
|
return($self->reference->[$#{$self->reference}]->end_token); |
|
|
0
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
} |
|
164
|
0
|
|
|
|
|
|
return(undef); |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub start_token { |
|
168
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
# warn $self->reference_name; |
|
171
|
|
|
|
|
|
|
|
|
172
|
0
|
0
|
|
|
|
|
if ($self->reference_name eq "list_refid_token") { |
|
173
|
0
|
|
|
|
|
|
return($self->reference->[0]); |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
#if list_refid token -> OK |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
# if refid word -> word->start_token |
|
178
|
|
|
|
|
|
|
# OR |
|
179
|
|
|
|
|
|
|
# if refid phrase -> phrase->start_token |
|
180
|
0
|
0
|
0
|
|
|
|
if (($self->reference_name eq "refid_word") || |
|
181
|
|
|
|
|
|
|
($self->reference_name eq "refid_phrase")){ |
|
182
|
0
|
|
|
|
|
|
return($self->reference->[0]->start_token); |
|
183
|
|
|
|
|
|
|
} |
|
184
|
0
|
|
|
|
|
|
return(undef); |
|
185
|
|
|
|
|
|
|
} |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub XMLout { |
|
190
|
0
|
|
|
0
|
0
|
|
my ($self, $order) = @_; |
|
191
|
|
|
|
|
|
|
|
|
192
|
0
|
|
|
|
|
|
return($self->SUPER::XMLout("phrase", $order)); |
|
193
|
|
|
|
|
|
|
} |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub getElementFormList { |
|
196
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
197
|
|
|
|
|
|
|
|
|
198
|
0
|
|
|
|
|
|
my $element; |
|
199
|
|
|
|
|
|
|
my @elements; |
|
200
|
|
|
|
|
|
|
|
|
201
|
0
|
|
|
|
|
|
foreach $element (@{$self->list_refid_components}) { |
|
|
0
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
# warn $element->getForm ."\n";" |
|
203
|
0
|
|
|
|
|
|
push @elements, $element->getElementFormList; |
|
204
|
|
|
|
|
|
|
} |
|
205
|
0
|
|
|
|
|
|
return(@elements); |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
} |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
sub getElementList { |
|
210
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
211
|
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
my $element; |
|
213
|
|
|
|
|
|
|
my @elements; |
|
214
|
|
|
|
|
|
|
|
|
215
|
0
|
|
|
|
|
|
foreach $element (@{$self->list_refid_components}) { |
|
|
0
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
# warn $element->getForm ."\n"; |
|
217
|
|
|
|
|
|
|
# warn "==>" . __PACKAGE__ . "\n"; |
|
218
|
0
|
0
|
|
|
|
|
if (ref($element) eq __PACKAGE__) { |
|
219
|
0
|
|
|
|
|
|
push @elements, $element->getElementList; |
|
220
|
|
|
|
|
|
|
} else { |
|
221
|
0
|
|
|
|
|
|
push @elements, $element; |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
} |
|
224
|
0
|
|
|
|
|
|
return(@elements); |
|
225
|
|
|
|
|
|
|
} |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub getLemmaString { |
|
228
|
0
|
|
|
0
|
0
|
|
my ($self, $document) = @_; |
|
229
|
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
|
my $lemma = ""; |
|
231
|
0
|
|
|
|
|
|
my $i = 0; |
|
232
|
0
|
|
|
|
|
|
my $token = $self->start_token; |
|
233
|
0
|
|
|
|
|
|
my @elmts = $self->getElementList; |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
# warn join(':',$self->getElementList) . "\n"; |
|
236
|
0
|
|
0
|
|
|
|
do { |
|
237
|
|
|
|
|
|
|
# warn $token->getId . "\n"; |
|
238
|
|
|
|
|
|
|
# warn $elmts[$i]->start_token->getId . "\n"; |
|
239
|
|
|
|
|
|
|
# warn $self->end_token->getId . "\n"; |
|
240
|
0
|
0
|
|
|
|
|
if ($token->equals($elmts[$i]->start_token)) { |
|
241
|
0
|
0
|
|
|
|
|
if (ref($elmts[$i]) eq "Lingua::Ogmios::Annotations::Word") { |
|
|
|
0
|
|
|
|
|
|
|
242
|
0
|
|
|
|
|
|
$lemma .= $elmts[$i]->getLemma($document)->canonical_form; |
|
243
|
0
|
|
|
|
|
|
$token = $elmts[$i]->end_token; |
|
244
|
0
|
|
|
|
|
|
$i++; |
|
245
|
|
|
|
|
|
|
} elsif (ref($elmts[$i]) eq "Lingua::Ogmios::Annotations::Phrase") { |
|
246
|
0
|
|
|
|
|
|
$lemma .= $elmts[$i]->getLemmaString($document); |
|
247
|
0
|
|
|
|
|
|
$token = $elmts[$i]->end_token; |
|
248
|
0
|
|
|
|
|
|
$i++; |
|
249
|
|
|
|
|
|
|
} |
|
250
|
|
|
|
|
|
|
} else { |
|
251
|
0
|
|
|
|
|
|
$lemma .= $token->getContent; |
|
252
|
|
|
|
|
|
|
} |
|
253
|
|
|
|
|
|
|
# if (!($token->equals($self->end_token))) { |
|
254
|
|
|
|
|
|
|
# warn "NEXT\n"; |
|
255
|
0
|
|
|
|
|
|
$token = $token->next; |
|
256
|
|
|
|
|
|
|
# } |
|
257
|
|
|
|
|
|
|
# warn "===\n"; |
|
258
|
|
|
|
|
|
|
} while((defined $token) && (!($token->previous->equals($self->end_token)))); |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
# foreach $elmt ($self->getElementList) { |
|
261
|
|
|
|
|
|
|
# warn "$elmt\n"; |
|
262
|
|
|
|
|
|
|
# # if (ref($elmt) eq "Lingua::Ogmios::Annotations::Token") { |
|
263
|
|
|
|
|
|
|
# # $lemma .= $elmt->getContent; |
|
264
|
|
|
|
|
|
|
# # } |
|
265
|
|
|
|
|
|
|
# if (ref($elmt) eq "Lingua::Ogmios::Annotations::Word") { |
|
266
|
|
|
|
|
|
|
# $lemma .= $elmt->getLemma($document)->canonical_form; |
|
267
|
|
|
|
|
|
|
# } |
|
268
|
|
|
|
|
|
|
# if (ref($elmt) eq "Lingua::Ogmios::Annotations::Phrase") { |
|
269
|
|
|
|
|
|
|
# $lemma .= $elmt->getLemmaString($document); |
|
270
|
|
|
|
|
|
|
# } |
|
271
|
|
|
|
|
|
|
# $lemma .= " "; |
|
272
|
|
|
|
|
|
|
# } |
|
273
|
|
|
|
|
|
|
# chop $lemma; |
|
274
|
0
|
|
|
|
|
|
return($lemma); |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
} |
|
278
|
|
|
|
|
|
|
sub getLemmaString_v1 { |
|
279
|
0
|
|
|
0
|
0
|
|
my ($self, $document) = @_; |
|
280
|
|
|
|
|
|
|
|
|
281
|
0
|
|
|
|
|
|
my $elmt; |
|
282
|
0
|
|
|
|
|
|
my $lemma = ""; |
|
283
|
0
|
|
|
|
|
|
foreach $elmt ($self->getElementList) { |
|
284
|
0
|
|
|
|
|
|
warn "$elmt\n"; |
|
285
|
0
|
0
|
|
|
|
|
if (ref($elmt) eq "Lingua::Ogmios::Annotations::Token") { |
|
286
|
0
|
|
|
|
|
|
$lemma .= $elmt->getContent; |
|
287
|
|
|
|
|
|
|
} |
|
288
|
0
|
0
|
|
|
|
|
if (ref($elmt) eq "Lingua::Ogmios::Annotations::Word") { |
|
289
|
0
|
|
|
|
|
|
$lemma .= $elmt->getLemma($document)->canonical_form; |
|
290
|
|
|
|
|
|
|
} |
|
291
|
0
|
0
|
|
|
|
|
if (ref($elmt) eq "Lingua::Ogmios::Annotations::Phrase") { |
|
292
|
0
|
|
|
|
|
|
$lemma .= $elmt->getLemmaString($document); |
|
293
|
|
|
|
|
|
|
} |
|
294
|
0
|
|
|
|
|
|
$lemma .= " "; |
|
295
|
|
|
|
|
|
|
} |
|
296
|
0
|
|
|
|
|
|
chop $lemma; |
|
297
|
0
|
|
|
|
|
|
return($lemma); |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
} |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
1; |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
__END__ |