line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::Ogmios::Annotations::Word; |
2
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
73
|
use Lingua::Ogmios::Annotations::Element; |
|
16
|
|
|
|
|
26
|
|
|
16
|
|
|
|
|
357
|
|
4
|
|
|
|
|
|
|
|
5
|
16
|
|
|
16
|
|
69
|
use strict; |
|
16
|
|
|
|
|
23
|
|
|
16
|
|
|
|
|
279
|
|
6
|
16
|
|
|
16
|
|
66
|
use warnings; |
|
16
|
|
|
|
|
27
|
|
|
16
|
|
|
|
|
13772
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Lingua::Ogmios::Annotations::Element); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
#
|
12
|
|
|
|
|
|
|
# form?) > |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
# |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
27
|
0
|
|
|
0
|
0
|
|
my ($class, $fields) = @_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if (!defined $fields->{'id'}) { |
30
|
0
|
|
|
|
|
|
$fields->{'id'} = -1; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
my $word = $class->SUPER::new({ |
33
|
0
|
|
|
|
|
|
'id' => $fields->{'id'}, |
34
|
|
|
|
|
|
|
# 'form' => $fields->{'form'}, |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
); |
37
|
0
|
|
|
|
|
|
bless ($word,$class); |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $i = 0; |
40
|
0
|
|
|
|
|
|
my $reference_name; |
41
|
|
|
|
|
|
|
my $ref; |
42
|
0
|
|
|
|
|
|
foreach $ref ('refid_phrase', 'refid_word', 'list_refid_token') { |
43
|
0
|
0
|
|
|
|
|
if (defined $fields->{$ref}) { |
44
|
0
|
|
|
|
|
|
$reference_name = $ref; |
45
|
0
|
|
|
|
|
|
last; |
46
|
|
|
|
|
|
|
} |
47
|
0
|
|
|
|
|
|
$i++; |
48
|
|
|
|
|
|
|
} |
49
|
0
|
0
|
|
|
|
|
if ($i == 3) { |
50
|
0
|
|
|
|
|
|
die("reference (list) is not defined"); |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
$word->reference($reference_name, $fields->{$reference_name}); |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
if (defined $fields->{'form'}) { |
55
|
0
|
|
|
|
|
|
$word->setForm($fields->{'form'}); |
56
|
|
|
|
|
|
|
} |
57
|
0
|
0
|
|
|
|
|
if (defined $fields->{'isNE'}) { |
58
|
0
|
|
|
|
|
|
$word->isNE($fields->{'isNE'}); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
if (defined $fields->{'log_id'}) { |
62
|
0
|
|
|
|
|
|
$word->setLogId($fields->{'log_id'}); |
63
|
|
|
|
|
|
|
} |
64
|
0
|
|
|
|
|
|
return($word); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub reference_name { |
69
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
|
$self->{'reference'} = shift if @_; |
72
|
0
|
|
|
|
|
|
return $self->{'reference'}; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub reference { |
77
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
78
|
0
|
|
|
|
|
|
my $ref; |
79
|
|
|
|
|
|
|
my $elt; |
80
|
|
|
|
|
|
|
|
81
|
0
|
0
|
0
|
|
|
|
if ((@_) && (scalar @_ == 2)) { |
82
|
0
|
|
|
|
|
|
$self->{'reference'} = shift; |
83
|
0
|
|
|
|
|
|
$self->{$self->{'reference'}} = []; |
84
|
0
|
|
|
|
|
|
$ref = shift; |
85
|
0
|
|
|
|
|
|
foreach $elt (@$ref) { |
86
|
0
|
|
|
|
|
|
push @{$self->{$self->{'reference'}}}, $elt; |
|
0
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
0
|
|
|
|
|
|
return($self->{$self->{'reference'}}); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub end_token { |
95
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
if ($self->reference_name eq "list_refid_token") { |
99
|
0
|
|
|
|
|
|
return($self->reference->[$#{$self->reference}]); |
|
0
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
#if list_refid token -> OK |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# if refid word -> word->start_token |
104
|
|
|
|
|
|
|
# OR |
105
|
|
|
|
|
|
|
# if refid phrase -> phrase->start_token |
106
|
0
|
0
|
0
|
|
|
|
if (($self->reference_name eq "refid_word") || |
107
|
|
|
|
|
|
|
($self->reference_name eq "refid_phrase")){ |
108
|
0
|
|
|
|
|
|
return($self->reference->end_token); |
109
|
|
|
|
|
|
|
} |
110
|
0
|
|
|
|
|
|
return(undef); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub start_token { |
114
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
0
|
0
|
|
|
|
|
if ($self->reference_name eq "list_refid_token") { |
118
|
0
|
|
|
|
|
|
return($self->reference->[0]); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
#if list_refid token -> OK |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
# if refid word -> word->start_token |
123
|
|
|
|
|
|
|
# OR |
124
|
|
|
|
|
|
|
# if refid phrase -> phrase->start_token |
125
|
0
|
0
|
0
|
|
|
|
if (($self->reference_name eq "refid_word") || |
126
|
|
|
|
|
|
|
($self->reference_name eq "refid_phrase")){ |
127
|
0
|
|
|
|
|
|
return($self->reference->start_token); |
128
|
|
|
|
|
|
|
} |
129
|
0
|
|
|
|
|
|
return(undef); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub getLastToken { |
134
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
my @Refs = @{$self->getReference}; |
|
0
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
my $last_token = $Refs[$#Refs]; |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
return($last_token); |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub getReferenceSize { |
143
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
return(scalar(@{$self->{$self->{'reference'}}})); |
|
0
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub getReference { |
149
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
return($self->{$self->{'reference'}}); |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub getReferenceIndex { |
155
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
156
|
0
|
|
|
|
|
|
my $idx = shift; |
157
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
return($self->{$self->{'reference'}}->[$idx]); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub isNE { |
162
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
163
|
|
|
|
|
|
|
|
164
|
0
|
0
|
|
|
|
|
$self->{'isNE'} = shift if @_; |
165
|
0
|
|
|
|
|
|
return($self->{'isNE'}); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub XMLout { |
169
|
0
|
|
|
0
|
0
|
|
my ($self, $order) = @_; |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
|
return($self->SUPER::XMLout("word", $order)); |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub getMorphoSyntacticFeatures { |
176
|
0
|
|
|
0
|
0
|
|
my ($self, $document) = @_; |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
return($document->getAnnotations->getMorphosyntacticFeaturesLevel->getElementFromIndex("refid_word", $self->getId)->[0]); |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
sub getLemma { |
182
|
0
|
|
|
0
|
0
|
|
my ($self, $document) = @_; |
183
|
|
|
|
|
|
|
|
184
|
0
|
|
|
|
|
|
return($document->getAnnotations->getLemmaLevel->getElementFromIndex("refid_word", $self->getId)->[0]); |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub getElementFormList { |
188
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
# warn $self->getForm ."\n"; |
191
|
|
|
|
|
|
|
|
192
|
0
|
|
|
|
|
|
return($self->getForm); |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
1; |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
__END__ |