| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Lingua::Ogmios::Annotations; |
|
2
|
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
78
|
use strict; |
|
|
16
|
|
|
|
|
48
|
|
|
|
16
|
|
|
|
|
386
|
|
|
4
|
16
|
|
|
16
|
|
74
|
use warnings; |
|
|
16
|
|
|
|
|
31
|
|
|
|
16
|
|
|
|
|
415
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
16
|
|
|
16
|
|
72
|
use Data::Dumper; |
|
|
16
|
|
|
|
|
27
|
|
|
|
16
|
|
|
|
|
818
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
16
|
|
|
16
|
|
9572
|
use Lingua::Ogmios::Annotations::Level; |
|
|
16
|
|
|
|
|
41
|
|
|
|
16
|
|
|
|
|
463
|
|
|
9
|
16
|
|
|
16
|
|
8769
|
use Lingua::Ogmios::Annotations::Section; |
|
|
16
|
|
|
|
|
40
|
|
|
|
16
|
|
|
|
|
427
|
|
|
10
|
16
|
|
|
16
|
|
8871
|
use Lingua::Ogmios::Annotations::Token; |
|
|
16
|
|
|
|
|
39
|
|
|
|
16
|
|
|
|
|
413
|
|
|
11
|
16
|
|
|
16
|
|
8127
|
use Lingua::Ogmios::Annotations::Word; |
|
|
16
|
|
|
|
|
36
|
|
|
|
16
|
|
|
|
|
418
|
|
|
12
|
16
|
|
|
16
|
|
8481
|
use Lingua::Ogmios::Annotations::Sentence; |
|
|
16
|
|
|
|
|
38
|
|
|
|
16
|
|
|
|
|
447
|
|
|
13
|
16
|
|
|
16
|
|
7994
|
use Lingua::Ogmios::Annotations::Lemma; |
|
|
16
|
|
|
|
|
38
|
|
|
|
16
|
|
|
|
|
441
|
|
|
14
|
16
|
|
|
16
|
|
8504
|
use Lingua::Ogmios::Annotations::MorphosyntacticFeatures; |
|
|
16
|
|
|
|
|
38
|
|
|
|
16
|
|
|
|
|
439
|
|
|
15
|
16
|
|
|
16
|
|
7795
|
use Lingua::Ogmios::Annotations::Stem; |
|
|
16
|
|
|
|
|
40
|
|
|
|
16
|
|
|
|
|
401
|
|
|
16
|
16
|
|
|
16
|
|
8590
|
use Lingua::Ogmios::Annotations::Phrase; |
|
|
16
|
|
|
|
|
40
|
|
|
|
16
|
|
|
|
|
442
|
|
|
17
|
16
|
|
|
16
|
|
8426
|
use Lingua::Ogmios::Annotations::Enumeration; |
|
|
16
|
|
|
|
|
39
|
|
|
|
16
|
|
|
|
|
454
|
|
|
18
|
16
|
|
|
16
|
|
9436
|
use Lingua::Ogmios::Annotations::SemanticUnit; |
|
|
16
|
|
|
|
|
41
|
|
|
|
16
|
|
|
|
|
445
|
|
|
19
|
16
|
|
|
16
|
|
8772
|
use Lingua::Ogmios::Annotations::SyntacticRelation; |
|
|
16
|
|
|
|
|
42
|
|
|
|
16
|
|
|
|
|
496
|
|
|
20
|
16
|
|
|
16
|
|
8513
|
use Lingua::Ogmios::Annotations::DomainSpecificRelation; |
|
|
16
|
|
|
|
|
39
|
|
|
|
16
|
|
|
|
|
446
|
|
|
21
|
16
|
|
|
16
|
|
8090
|
use Lingua::Ogmios::Annotations::AnaphoraRelation; |
|
|
16
|
|
|
|
|
36
|
|
|
|
16
|
|
|
|
|
420
|
|
|
22
|
16
|
|
|
16
|
|
8419
|
use Lingua::Ogmios::Annotations::SemanticFeatures; |
|
|
16
|
|
|
|
|
40
|
|
|
|
16
|
|
|
|
|
126883
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $debug_devel_level = 2; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
|
27
|
0
|
|
|
0
|
0
|
|
my ($class, $platformConfig) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $Annotations = { |
|
30
|
|
|
|
|
|
|
'language' => undef, |
|
31
|
|
|
|
|
|
|
'properties' => {}, |
|
32
|
|
|
|
|
|
|
'Namespace' => undef, |
|
33
|
|
|
|
|
|
|
'urls' => undef, |
|
34
|
|
|
|
|
|
|
'acquisition_section' => undef, |
|
35
|
|
|
|
|
|
|
'relevance_section' => undef, |
|
36
|
|
|
|
|
|
|
'canonical_document' => undef, |
|
37
|
|
|
|
|
|
|
'platformConfig' => $platformConfig, |
|
38
|
|
|
|
|
|
|
# 'canonical_document_section_positions' => [], # to delete |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
'section_level' => => Lingua::Ogmios::Annotations::Level->new ({ |
|
41
|
|
|
|
|
|
|
'name' => 'section', |
|
42
|
|
|
|
|
|
|
'indexes' => ['from', 'to', 'title', 'type'], |
|
43
|
|
|
|
|
|
|
'XML_order' => ['id', 'from', 'to'], |
|
44
|
|
|
|
|
|
|
}), |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
'log_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
47
|
|
|
|
|
|
|
'name' => 'log', |
|
48
|
|
|
|
|
|
|
'indexes' => ['log_id'], |
|
49
|
|
|
|
|
|
|
'XML_order' => ['log_id', 'software_name', 'command_line', 'stamp', |
|
50
|
|
|
|
|
|
|
'tagset', 'comments', 'list_modified_level'], |
|
51
|
|
|
|
|
|
|
}), |
|
52
|
|
|
|
|
|
|
'token_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
53
|
|
|
|
|
|
|
'name' => 'token', |
|
54
|
|
|
|
|
|
|
'indexes' => ['from', 'to', 'content'], |
|
55
|
|
|
|
|
|
|
'XML_order' => ['id', 'type', 'content', 'from', 'to'], |
|
56
|
|
|
|
|
|
|
}), |
|
57
|
|
|
|
|
|
|
'word_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
58
|
|
|
|
|
|
|
'name' => 'word', |
|
59
|
|
|
|
|
|
|
'indexes' => ['list_refid_token', 'form'], |
|
60
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'list_refid_token', 'form'], |
|
61
|
|
|
|
|
|
|
}), |
|
62
|
|
|
|
|
|
|
'phrase_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
63
|
|
|
|
|
|
|
'name' => 'phrase', |
|
64
|
|
|
|
|
|
|
'indexes' => ['list_refid_components'], |
|
65
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'type', 'list_refid_components', 'form'], |
|
66
|
|
|
|
|
|
|
}), |
|
67
|
|
|
|
|
|
|
'enumeration_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
68
|
|
|
|
|
|
|
'name' => 'enumeration', |
|
69
|
|
|
|
|
|
|
'indexes' => ['list_refid_components'], |
|
70
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'type', 'list_refid_components', 'form'], |
|
71
|
|
|
|
|
|
|
}), |
|
72
|
|
|
|
|
|
|
'sentence_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
73
|
|
|
|
|
|
|
'name' => 'sentence', |
|
74
|
|
|
|
|
|
|
'indexes' => ['refid_start_token', 'refid_end_token'], |
|
75
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'refid_start_token', 'refid_end_token', 'form', 'lang'], |
|
76
|
|
|
|
|
|
|
}), |
|
77
|
|
|
|
|
|
|
'syntactic_relation_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
78
|
|
|
|
|
|
|
'name' => 'syntactic_relation', |
|
79
|
|
|
|
|
|
|
'indexes' => ['refid_head', 'refid_modifier', 'syntactic_relation_type'], |
|
80
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'syntactic_relation_type', 'refid_head', 'refid_modifier'], |
|
81
|
|
|
|
|
|
|
}), |
|
82
|
|
|
|
|
|
|
'semantic_unit_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
83
|
|
|
|
|
|
|
'name' => 'semantic_unit', |
|
84
|
|
|
|
|
|
|
'indexes' => ['refid_phrase', 'refid_word', 'list_refid_token', 'form', 'type', 'canonical_form'], |
|
85
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'refid_phrase', 'refid_word', 'list_refid_token', |
|
86
|
|
|
|
|
|
|
'form', 'canonical_form', 'named_entity_type', 'weights', 'negation'], |
|
87
|
|
|
|
|
|
|
}), |
|
88
|
|
|
|
|
|
|
'domain_specific_relation_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
89
|
|
|
|
|
|
|
'name' => 'domain_specific_relation', |
|
90
|
|
|
|
|
|
|
'indexes' => ['list_refid_semantic_unit'], |
|
91
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'domain_specific_relation_type', 'list_refid_semantic_unit'], |
|
92
|
|
|
|
|
|
|
}), |
|
93
|
|
|
|
|
|
|
'anaphora_relation_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
94
|
|
|
|
|
|
|
'name' => 'anaphora_relation', |
|
95
|
|
|
|
|
|
|
'indexes' => ['anaphora', 'antecent'], |
|
96
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'anaphora_relation_type', 'anaphora', 'antecedent'], |
|
97
|
|
|
|
|
|
|
}), |
|
98
|
|
|
|
|
|
|
'lemma_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
99
|
|
|
|
|
|
|
'name' => 'lemma', |
|
100
|
|
|
|
|
|
|
'indexes' => ['refid_word'], |
|
101
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'canonical_form', 'refid_word', 'form'], |
|
102
|
|
|
|
|
|
|
}), |
|
103
|
|
|
|
|
|
|
'morphosyntactic_features_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
104
|
|
|
|
|
|
|
'name' => 'morphosyntactic_features', |
|
105
|
|
|
|
|
|
|
'indexes' => ['refid_word', 'refid_phrase'], |
|
106
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'refid_word', 'refid_phrase', 'syntactic_category', |
|
107
|
|
|
|
|
|
|
'category', 'type', 'gender', 'number', 'case', 'mood_vform', 'tense', 'person', |
|
108
|
|
|
|
|
|
|
'degree', 'possessor', 'formation', 'form'], |
|
109
|
|
|
|
|
|
|
}), |
|
110
|
|
|
|
|
|
|
'semantic_features_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
111
|
|
|
|
|
|
|
'name' => 'semantic_features', |
|
112
|
|
|
|
|
|
|
'indexes' => ['refid_semantic_unit'], |
|
113
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'refid_semantic_unit', 'semantic_category'], |
|
114
|
|
|
|
|
|
|
}), |
|
115
|
|
|
|
|
|
|
'stem_level' => Lingua::Ogmios::Annotations::Level->new ({ |
|
116
|
|
|
|
|
|
|
'name' => 'stem', |
|
117
|
|
|
|
|
|
|
'indexes' => ['refid_word'], |
|
118
|
|
|
|
|
|
|
'XML_order' => ['id', 'log_id', 'stem_form', 'refid_word', 'form'], |
|
119
|
|
|
|
|
|
|
}), |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
}; |
|
122
|
0
|
|
|
|
|
|
bless $Annotations, $class; |
|
123
|
0
|
|
|
|
|
|
return ($Annotations); |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub getLevels4Print { |
|
127
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# 'section_level', |
|
130
|
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
my @levels_id = ('log_level', |
|
132
|
|
|
|
|
|
|
'token_level'); |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
0
|
0
|
|
|
|
if ((defined $self->platformConfig->xmloutput_sectionLevel) && |
|
135
|
|
|
|
|
|
|
($self->platformConfig->xmloutput_sectionLevel == 1)) { |
|
136
|
0
|
|
|
|
|
|
push @levels_id, 'section_level'; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
push @levels_id, ('word_level', |
|
140
|
|
|
|
|
|
|
'sentence_level', |
|
141
|
|
|
|
|
|
|
'phrase_level'); |
|
142
|
0
|
0
|
0
|
|
|
|
if ((defined $self->platformConfig->xmloutput_enumerationLevel) && |
|
143
|
|
|
|
|
|
|
($self->platformConfig->xmloutput_enumerationLevel == 1)) { |
|
144
|
0
|
|
|
|
|
|
push @levels_id, 'enumeration_level'; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
push @levels_id, ('semantic_unit_level', |
|
148
|
|
|
|
|
|
|
'lemma_level', |
|
149
|
|
|
|
|
|
|
'stem_level', |
|
150
|
|
|
|
|
|
|
'morphosyntactic_features_level', |
|
151
|
|
|
|
|
|
|
'syntactic_relation_level', |
|
152
|
|
|
|
|
|
|
'semantic_features_level', |
|
153
|
|
|
|
|
|
|
'domain_specific_relation_level', |
|
154
|
|
|
|
|
|
|
'anaphora_relation_level', |
|
155
|
|
|
|
|
|
|
); |
|
156
|
0
|
|
|
|
|
|
my $id; |
|
157
|
|
|
|
|
|
|
my @levels; |
|
158
|
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
foreach $id (@levels_id) { |
|
160
|
0
|
0
|
|
|
|
|
if ($self->{$id}->getId > 0) { |
|
161
|
0
|
|
|
|
|
|
warn "level: $id\n"; |
|
162
|
0
|
|
|
|
|
|
push @levels, $self->{$id}; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
} |
|
165
|
0
|
|
|
|
|
|
return(@levels); |
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub getLevels { |
|
169
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
# 'section_level', |
|
172
|
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
my @levels_id = ('log_level', |
|
174
|
|
|
|
|
|
|
'token_level', |
|
175
|
|
|
|
|
|
|
'word_level', |
|
176
|
|
|
|
|
|
|
'sentence_level', |
|
177
|
|
|
|
|
|
|
'phrase_level', |
|
178
|
|
|
|
|
|
|
'enumeration_level', |
|
179
|
|
|
|
|
|
|
'semantic_unit_level', |
|
180
|
|
|
|
|
|
|
'lemma_level', |
|
181
|
|
|
|
|
|
|
'stem_level', |
|
182
|
|
|
|
|
|
|
'morphosyntactic_features_level', |
|
183
|
|
|
|
|
|
|
'syntactic_relation_level', |
|
184
|
|
|
|
|
|
|
'semantic_features_level', |
|
185
|
|
|
|
|
|
|
'domain_specific_relation_level', |
|
186
|
|
|
|
|
|
|
'anaphora_relation_level', |
|
187
|
|
|
|
|
|
|
); |
|
188
|
0
|
|
|
|
|
|
my $id; |
|
189
|
|
|
|
|
|
|
my @levels; |
|
190
|
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
foreach $id (@levels_id) { |
|
192
|
0
|
0
|
|
|
|
|
if ($self->{$id}->getId > 0) { |
|
193
|
0
|
|
|
|
|
|
warn "level: $id\n"; |
|
194
|
0
|
|
|
|
|
|
push @levels, $self->{$id}; |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
} |
|
197
|
0
|
|
|
|
|
|
return(@levels); |
|
198
|
|
|
|
|
|
|
} |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub setLanguageFromXMLAndProperties { |
|
201
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
202
|
0
|
|
|
|
|
|
my $acquisition_section_node = shift; |
|
203
|
|
|
|
|
|
|
|
|
204
|
0
|
0
|
|
|
|
|
print STDERR "\nSetting Language: " unless $debug_devel_level != 2; |
|
205
|
|
|
|
|
|
|
|
|
206
|
0
|
|
|
|
|
|
my $analysis = $acquisition_section_node->getChildrenByTagName('analysis')->get_node(1); |
|
207
|
0
|
0
|
|
|
|
|
if (defined $analysis) { |
|
208
|
|
|
|
|
|
|
# my @properties = $analysis->getChildrenByTagName('property'); |
|
209
|
|
|
|
|
|
|
# warn join(":", @properties) . "\n"; |
|
210
|
0
|
|
|
|
|
|
my $prop; |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
# warn $analysis->getChildrenByTagName('property')->get_node(1)->getAttribute("name") . "\n"; |
|
213
|
|
|
|
|
|
|
|
|
214
|
0
|
|
|
|
|
|
foreach $prop ($analysis->getChildrenByTagName('property')) { |
|
215
|
|
|
|
|
|
|
# warn "$prop\n"; |
|
216
|
0
|
0
|
|
|
|
|
if (defined $prop->hasAttribute("name")) { |
|
217
|
0
|
0
|
|
|
|
|
if ($prop->getAttribute("name") eq "language") { |
|
218
|
|
|
|
|
|
|
# warn $prop->firstChild->toString . "\n"; |
|
219
|
|
|
|
|
|
|
# warn $prop->toString . "\n"; |
|
220
|
0
|
|
|
|
|
|
$self->{"language"} = uc($prop->firstChild->toString); |
|
221
|
0
|
0
|
|
|
|
|
warn $self->{"language"} . "\n" unless $debug_devel_level != 2; |
|
222
|
|
|
|
|
|
|
} |
|
223
|
0
|
|
|
|
|
|
$self->{'properties'}->{$prop->getAttribute("name")} = $prop->firstChild->toString; |
|
224
|
|
|
|
|
|
|
} |
|
225
|
|
|
|
|
|
|
} |
|
226
|
|
|
|
|
|
|
} |
|
227
|
|
|
|
|
|
|
} |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub getLanguage { |
|
230
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
231
|
|
|
|
|
|
|
|
|
232
|
0
|
|
|
|
|
|
return($self->{"language"}); |
|
233
|
|
|
|
|
|
|
} |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
sub setLanguage { |
|
236
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
237
|
|
|
|
|
|
|
|
|
238
|
0
|
|
|
|
|
|
$self->{"language"} = shift; |
|
239
|
0
|
|
|
|
|
|
return($self->{"language"}); |
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub getProperties { |
|
243
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
244
|
|
|
|
|
|
|
|
|
245
|
0
|
|
|
|
|
|
return($self->{"properties"}); |
|
246
|
|
|
|
|
|
|
} |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
sub getProperty { |
|
249
|
0
|
|
|
0
|
0
|
|
my ($self, $propertyName) = @_; |
|
250
|
|
|
|
|
|
|
|
|
251
|
0
|
|
|
|
|
|
return($self->getProperties->{$propertyName}); |
|
252
|
|
|
|
|
|
|
} |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub delProperty { |
|
255
|
0
|
|
|
0
|
0
|
|
my ($self, $propertyName) = @_; |
|
256
|
|
|
|
|
|
|
|
|
257
|
0
|
|
|
|
|
|
delete($self->getProperties->{$propertyName}); |
|
258
|
0
|
|
|
|
|
|
return(undef); |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
sub setProperty { |
|
262
|
0
|
|
|
0
|
0
|
|
my ($self, $propertyName, $value, $separator) = @_; |
|
263
|
0
|
0
|
|
|
|
|
if (!defined $separator) { |
|
264
|
0
|
|
|
|
|
|
$separator = ";"; |
|
265
|
|
|
|
|
|
|
} |
|
266
|
|
|
|
|
|
|
|
|
267
|
0
|
0
|
|
|
|
|
if (!exists $self->getProperties->{$propertyName}) { |
|
268
|
0
|
|
|
|
|
|
$self->getProperties->{$propertyName} = $value; |
|
269
|
|
|
|
|
|
|
} else { |
|
270
|
0
|
|
|
|
|
|
$self->getProperties->{$propertyName} .= "$separator$value"; |
|
271
|
|
|
|
|
|
|
} |
|
272
|
|
|
|
|
|
|
|
|
273
|
0
|
|
|
|
|
|
return($self->getProperties->{$propertyName}); |
|
274
|
|
|
|
|
|
|
} |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
sub replaceProperty { |
|
277
|
0
|
|
|
0
|
0
|
|
my ($self, $propertyName, $value) = @_; |
|
278
|
|
|
|
|
|
|
|
|
279
|
0
|
|
|
|
|
|
$self->getProperties->{$propertyName} = $value; |
|
280
|
|
|
|
|
|
|
|
|
281
|
0
|
|
|
|
|
|
return($self->getProperties->{$propertyName}); |
|
282
|
|
|
|
|
|
|
} |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub platformConfig { |
|
285
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
286
|
|
|
|
|
|
|
|
|
287
|
0
|
0
|
|
|
|
|
if (@_) { |
|
288
|
0
|
|
|
|
|
|
$self->{"platformConfig"} = shift; |
|
289
|
|
|
|
|
|
|
} |
|
290
|
|
|
|
|
|
|
|
|
291
|
0
|
|
|
|
|
|
return($self->{"platformConfig"}); |
|
292
|
|
|
|
|
|
|
} |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
sub setURLs { |
|
295
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
296
|
0
|
|
|
|
|
|
my $acquisition_section_node = shift; |
|
297
|
|
|
|
|
|
|
|
|
298
|
0
|
|
|
|
|
|
my $url; |
|
299
|
|
|
|
|
|
|
|
|
300
|
0
|
0
|
|
|
|
|
print STDERR "\nSetting URLs: " unless $debug_devel_level != 2; |
|
301
|
|
|
|
|
|
|
|
|
302
|
0
|
|
|
|
|
|
my $acquisitionData = $acquisition_section_node->getChildrenByTagName('acquisitionData')->get_node(1); |
|
303
|
|
|
|
|
|
|
|
|
304
|
0
|
0
|
|
|
|
|
if (defined $acquisitionData) { |
|
305
|
0
|
|
|
|
|
|
my $urls = $acquisitionData->getChildrenByTagName('urls')->get_node(1); |
|
306
|
0
|
0
|
|
|
|
|
if (defined $urls) { |
|
307
|
0
|
|
|
|
|
|
my @urls; |
|
308
|
0
|
|
|
|
|
|
$self->{'urls'} = \@urls; |
|
309
|
0
|
|
|
|
|
|
foreach $url ($urls->getChildrenByTagName('url')) { |
|
310
|
|
|
|
|
|
|
# warn $url->firstChild->toString . "\n"; |
|
311
|
0
|
|
|
|
|
|
push @urls, $url->firstChild->toString; |
|
312
|
|
|
|
|
|
|
} |
|
313
|
|
|
|
|
|
|
} |
|
314
|
|
|
|
|
|
|
} |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
} |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
sub getURLs { |
|
320
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
321
|
|
|
|
|
|
|
|
|
322
|
0
|
|
|
|
|
|
return($self->{"urls"}); |
|
323
|
|
|
|
|
|
|
} |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
sub setCanonicalDocument { |
|
326
|
0
|
|
|
0
|
0
|
|
my ($self, $canonicalDocument) = @_; |
|
327
|
|
|
|
|
|
|
|
|
328
|
0
|
|
|
|
|
|
$self->{'canonical_document'} = $canonicalDocument; |
|
329
|
|
|
|
|
|
|
} |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
sub load_LogLevel { |
|
332
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
333
|
|
|
|
|
|
|
|
|
334
|
0
|
|
|
|
|
|
my $LogLevel = $linguistic_analysis_node->getChildrenByTagName('log_level')->get_node(1); |
|
335
|
|
|
|
|
|
|
|
|
336
|
0
|
|
|
|
|
|
my $logprocessing_node; |
|
337
|
|
|
|
|
|
|
my $fields; |
|
338
|
0
|
|
|
|
|
|
my $XML_order = $self->getLogLevel->getXMLorder;; |
|
339
|
0
|
|
|
|
|
|
my $element; |
|
340
|
|
|
|
|
|
|
my @nodes; |
|
341
|
0
|
|
|
|
|
|
my $node; |
|
342
|
|
|
|
|
|
|
|
|
343
|
0
|
0
|
|
|
|
|
if (defined $LogLevel) { |
|
344
|
0
|
|
|
|
|
|
warn "Loading Log Level\n"; |
|
345
|
0
|
|
|
|
|
|
foreach $logprocessing_node ($LogLevel->getChildrenByTagName('log_processing')) { |
|
346
|
0
|
|
|
|
|
|
$fields = {}; |
|
347
|
0
|
|
|
|
|
|
foreach $element (@$XML_order) { |
|
348
|
0
|
|
|
|
|
|
@nodes = $logprocessing_node->getChildrenByTagName($element); |
|
349
|
|
|
|
|
|
|
# warn "$element (" . scalar(@nodes) .")\n"; |
|
350
|
|
|
|
|
|
|
# if (scalar(@nodes) > 1) { |
|
351
|
0
|
0
|
|
|
|
|
if ($element =~ /^list_/) { |
|
352
|
0
|
|
|
|
|
|
my @values; |
|
353
|
0
|
|
|
|
|
|
foreach $node (@nodes) { |
|
354
|
|
|
|
|
|
|
# warn "$element:" . $node->textContent . "\n"; |
|
355
|
0
|
|
|
|
|
|
push @values, $node->textContent; |
|
356
|
|
|
|
|
|
|
} |
|
357
|
0
|
|
|
|
|
|
$fields->{$element} = \@values; |
|
358
|
|
|
|
|
|
|
} else { |
|
359
|
0
|
0
|
|
|
|
|
if (scalar(@nodes) > 0) { |
|
360
|
|
|
|
|
|
|
# warn "$element:" . $nodes[0]->textContent . "\n"; |
|
361
|
0
|
|
|
|
|
|
$fields->{$element} = $nodes[0]->textContent; |
|
362
|
|
|
|
|
|
|
} |
|
363
|
|
|
|
|
|
|
} |
|
364
|
|
|
|
|
|
|
} |
|
365
|
0
|
|
|
|
|
|
$self->addLogProcessing(Lingua::Ogmios::Annotations::LogProcessing->new($fields)); |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
} |
|
368
|
0
|
|
|
|
|
|
warn "done\n"; |
|
369
|
|
|
|
|
|
|
} |
|
370
|
|
|
|
|
|
|
} |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
sub load_TokenLevel { |
|
374
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
|
my $token_level_node = $linguistic_analysis_node->getChildrenByTagName('token_level')->get_node(1); |
|
378
|
0
|
|
|
|
|
|
my $token_node; |
|
379
|
0
|
|
|
|
|
|
my $XML_order = $self->getTokenLevel->getXMLorder; |
|
380
|
0
|
|
|
|
|
|
my $element; |
|
381
|
|
|
|
|
|
|
my $token; |
|
382
|
0
|
|
|
|
|
|
my $fields; |
|
383
|
|
|
|
|
|
|
|
|
384
|
0
|
0
|
|
|
|
|
if (defined $token_level_node) { |
|
385
|
0
|
|
|
|
|
|
warn "Loading Token Level\n"; |
|
386
|
0
|
|
|
|
|
|
warn " " . $token_level_node->getChildrenByTagName('token')->size . " to load\n"; |
|
387
|
0
|
|
|
|
|
|
foreach $token_node ($token_level_node->getChildrenByTagName('token')) { |
|
388
|
|
|
|
|
|
|
# warn "$token_node\n"; |
|
389
|
0
|
|
|
|
|
|
$fields = {}; |
|
390
|
0
|
|
|
|
|
|
foreach $element (@$XML_order) { |
|
391
|
|
|
|
|
|
|
# warn "$element:" . $token_node->getChildrenByTagName($element)->get_node(1)->textContent . "\n"; |
|
392
|
0
|
|
|
|
|
|
$fields->{$element} = $token_node->getChildrenByTagName($element)->get_node(1)->textContent; |
|
393
|
|
|
|
|
|
|
} |
|
394
|
0
|
|
|
|
|
|
$self->addToken(Lingua::Ogmios::Annotations::Token->new($fields)); |
|
395
|
|
|
|
|
|
|
} |
|
396
|
0
|
|
|
|
|
|
warn "done\n"; |
|
397
|
|
|
|
|
|
|
} |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
} |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
sub makeElementRefFromId { |
|
402
|
0
|
|
|
0
|
0
|
|
my ($self, $fields) = @_; |
|
403
|
0
|
|
|
|
|
|
my $element; |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
# print STDERR Dumper($fields) . "\n"; |
|
406
|
|
|
|
|
|
|
|
|
407
|
0
|
0
|
|
|
|
|
if (exists $fields->{'list_refid_token'}) { |
|
408
|
0
|
|
|
|
|
|
my @element_list; |
|
409
|
0
|
|
|
|
|
|
foreach $element (@{$fields->{'list_refid_token'}}) { |
|
|
0
|
|
|
|
|
|
|
|
410
|
0
|
|
|
|
|
|
push @element_list, $self->getTokenLevel->getElementById($element); |
|
411
|
|
|
|
|
|
|
} |
|
412
|
0
|
|
|
|
|
|
$fields->{'list_refid_token'} = \@element_list; |
|
413
|
|
|
|
|
|
|
} |
|
414
|
0
|
0
|
|
|
|
|
if (exists $fields->{'refid_word'}) { |
|
415
|
0
|
|
|
|
|
|
my @element_list; |
|
416
|
0
|
0
|
|
|
|
|
if (ref($fields->{'refid_word'}) eq "ARRAY") { |
|
417
|
0
|
|
|
|
|
|
foreach $element (@{$fields->{'refid_word'}}) { |
|
|
0
|
|
|
|
|
|
|
|
418
|
0
|
|
|
|
|
|
push @element_list, $self->getWordLevel->getElementById($element); |
|
419
|
|
|
|
|
|
|
} |
|
420
|
0
|
|
|
|
|
|
$fields->{'refid_word'} = \@element_list; |
|
421
|
|
|
|
|
|
|
} else { |
|
422
|
0
|
|
|
|
|
|
$fields->{'refid_word'} = $self->getWordLevel->getElementById($fields->{'refid_word'}); |
|
423
|
|
|
|
|
|
|
} |
|
424
|
|
|
|
|
|
|
} |
|
425
|
0
|
0
|
|
|
|
|
if (exists $fields->{'refid_phrase'}) { |
|
426
|
0
|
|
|
|
|
|
my @element_list; |
|
427
|
0
|
0
|
|
|
|
|
if (ref($fields->{'refid_phrase'}) eq "ARRAY") { |
|
428
|
0
|
|
|
|
|
|
foreach $element (@{$fields->{'refid_phrase'}}) { |
|
|
0
|
|
|
|
|
|
|
|
429
|
0
|
|
|
|
|
|
push @element_list, $self->getPhraseLevel->getElementById($element); |
|
430
|
|
|
|
|
|
|
} |
|
431
|
0
|
|
|
|
|
|
$fields->{'refid_phrase'} = \@element_list; |
|
432
|
|
|
|
|
|
|
} else { |
|
433
|
0
|
|
|
|
|
|
$fields->{'refid_phrase'} = $self->getPhraseLevel->getElementById($fields->{'refid_phrase'}); |
|
434
|
|
|
|
|
|
|
} |
|
435
|
|
|
|
|
|
|
} |
|
436
|
0
|
0
|
|
|
|
|
if (exists $fields->{'refid_semantic_unit'}) { |
|
437
|
0
|
|
|
|
|
|
my @element_list; |
|
438
|
0
|
0
|
|
|
|
|
if (ref($fields->{'refid_semantic_unit'}) eq "ARRAY") { |
|
439
|
0
|
|
|
|
|
|
foreach $element (@{$fields->{'refid_semantic_unit'}}) { |
|
|
0
|
|
|
|
|
|
|
|
440
|
0
|
|
|
|
|
|
push @element_list, $self->getSemanticUnitLevel->getElementById($element); |
|
441
|
|
|
|
|
|
|
} |
|
442
|
0
|
|
|
|
|
|
$fields->{'refid_semantic_unit'} = \@element_list; |
|
443
|
|
|
|
|
|
|
} else { |
|
444
|
0
|
|
|
|
|
|
$fields->{'refid_semantic_unit'} = $self->getSemanticUnitLevel->getElementById($fields->{'refid_semantic_unit'}); |
|
445
|
|
|
|
|
|
|
} |
|
446
|
|
|
|
|
|
|
} |
|
447
|
0
|
0
|
|
|
|
|
if (exists $fields->{'refid_start_token'}) { |
|
448
|
0
|
|
|
|
|
|
$fields->{'refid_start_token'} = $self->getTokenLevel->getElementById($fields->{'refid_start_token'}); |
|
449
|
|
|
|
|
|
|
} |
|
450
|
0
|
0
|
|
|
|
|
if (exists $fields->{'refid_end_token'}) { |
|
451
|
0
|
|
|
|
|
|
$fields->{'refid_end_token'} = $self->getTokenLevel->getElementById($fields->{'refid_end_token'}); |
|
452
|
|
|
|
|
|
|
} |
|
453
|
|
|
|
|
|
|
# print STDERR Dumper($fields) . "\n"; |
|
454
|
|
|
|
|
|
|
} |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
sub load_Level { |
|
458
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node, $level_name, $node_name, $XML_order) = @_; |
|
459
|
|
|
|
|
|
|
|
|
460
|
0
|
|
|
|
|
|
my $word_node; |
|
461
|
|
|
|
|
|
|
# my $XML_order = $self->getWordLevel->getXMLorder; |
|
462
|
|
|
|
|
|
|
my $element; |
|
463
|
|
|
|
|
|
|
# my $fields; |
|
464
|
0
|
|
|
|
|
|
my @nodes; |
|
465
|
0
|
|
|
|
|
|
my $node; |
|
466
|
0
|
|
|
|
|
|
my $inner_node; |
|
467
|
|
|
|
|
|
|
|
|
468
|
0
|
|
|
|
|
|
my @nodeList; |
|
469
|
0
|
|
|
|
|
|
my $inner_element; |
|
470
|
|
|
|
|
|
|
|
|
471
|
0
|
|
|
|
|
|
my $level_node = $linguistic_analysis_node->getChildrenByTagName($level_name)->get_node(1); |
|
472
|
0
|
0
|
|
|
|
|
if (defined $level_node) { |
|
473
|
|
|
|
|
|
|
# warn "Loading $node_name Level\n"; |
|
474
|
|
|
|
|
|
|
# warn " " . $level_node->getElementsByTagName($node_name)->size . " to load\n"; |
|
475
|
0
|
|
|
|
|
|
foreach $node ($level_node->getElementsByTagName($node_name)) { |
|
476
|
0
|
|
|
|
|
|
my $fields = {}; |
|
477
|
0
|
|
|
|
|
|
foreach $element (@$XML_order) { |
|
478
|
0
|
|
|
|
|
|
@nodes = $node->getChildrenByTagName($element); |
|
479
|
|
|
|
|
|
|
# warn "\tnb nodes: " . scalar(@nodes) . "\n"; |
|
480
|
0
|
0
|
|
|
|
|
if (scalar(@nodes) > 1) { |
|
481
|
|
|
|
|
|
|
# warn "+++++\n"; |
|
482
|
0
|
|
|
|
|
|
my @values; |
|
483
|
0
|
|
|
|
|
|
foreach $inner_node (@nodes) { |
|
484
|
|
|
|
|
|
|
# warn "$element (1):" . $inner_node->textContent . "\n"; |
|
485
|
0
|
|
|
|
|
|
push @values, $inner_node->textContent; |
|
486
|
|
|
|
|
|
|
} |
|
487
|
0
|
|
|
|
|
|
$fields->{$element} = \@values; |
|
488
|
|
|
|
|
|
|
} else { |
|
489
|
0
|
0
|
|
|
|
|
if (scalar(@nodes) == 1) { |
|
490
|
|
|
|
|
|
|
# warn " => " . $nodes[0]->nodeName . "\n"; |
|
491
|
|
|
|
|
|
|
# warn "$element (2): " . $nodes[0]->hasChildNodes . "\n"; |
|
492
|
|
|
|
|
|
|
# warn "$element (2): " . $nodes[0]->textContent . "\n"; |
|
493
|
|
|
|
|
|
|
# childNodes |
|
494
|
0
|
0
|
|
|
|
|
if ($nodes[0]->hasChildNodes) { |
|
495
|
|
|
|
|
|
|
# hasAttribute |
|
496
|
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
# warn "=> " . $nodes[0]->childNodes . "\n"; |
|
498
|
|
|
|
|
|
|
# warn "=>(NT) " . $nodes[0]->nodeType . "\n"; |
|
499
|
0
|
0
|
0
|
|
|
|
if ((scalar(@{$nodes[0]->childNodes}) == 1) && ($nodes[0]->childNodes->get_node(1)->nodeName eq "#text")){ |
|
|
0
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
# warn "----->" . $nodes[0]->childNodes->[0]->textContent . "\n"; |
|
501
|
0
|
|
|
|
|
|
$fields->{$element} = $nodes[0]->childNodes->get_node(1)->textContent; |
|
502
|
|
|
|
|
|
|
# } else { |
|
503
|
|
|
|
|
|
|
# warn "===> " . $nodes[0]->childNodes->get_node(1)->nodeName . "\n"; |
|
504
|
|
|
|
|
|
|
# if (($nodes[0]->childNodes->get_node(1)->nodeName ne "#text") && |
|
505
|
|
|
|
|
|
|
# ($nodes[0]->childNodes->get_node(1)->hasAttribute)) { |
|
506
|
|
|
|
|
|
|
# # if (($nodes[0]->childNodes->get_node(1)->nodeName ne "#text") && |
|
507
|
|
|
|
|
|
|
# # ($nodes[0]->childNodes->get_node(1)->hasAttribute)) { |
|
508
|
|
|
|
|
|
|
# # my %values; |
|
509
|
|
|
|
|
|
|
# warn "===> " . $nodes[0]->childNodes->get_node(1)->textContent . "\n"; |
|
510
|
|
|
|
|
|
|
# warn "\tAttributes\n"; |
|
511
|
|
|
|
|
|
|
# warn "\t" . Dumper($node->attributes()) . "\n"; |
|
512
|
|
|
|
|
|
|
# # foreach $inner_node ($nodes[0]->childNodes) { |
|
513
|
|
|
|
|
|
|
# # warn "====\n"; |
|
514
|
|
|
|
|
|
|
# # warn " " . $inner_node->nodeName . "\n"; |
|
515
|
|
|
|
|
|
|
# # if ($inner_node->hasChildNodes) { |
|
516
|
|
|
|
|
|
|
# # warn $inner_node->nodeName . " (3):" . $inner_node->textContent . "\n"; |
|
517
|
|
|
|
|
|
|
# # warn " (NT) " . $inner_node->nodeType . "\n"; |
|
518
|
|
|
|
|
|
|
# # $values{$nodes[0]->childNodes->getAttribute} = $inner_node->textContent; |
|
519
|
|
|
|
|
|
|
# # } |
|
520
|
|
|
|
|
|
|
# # } |
|
521
|
|
|
|
|
|
|
# # $fields->{$element} = \%values; |
|
522
|
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
} else { |
|
524
|
0
|
|
|
|
|
|
my @values_t; |
|
525
|
|
|
|
|
|
|
my %values_h; |
|
526
|
0
|
|
|
|
|
|
my $nodetmp = $nodes[0]; |
|
527
|
|
|
|
|
|
|
# warn "===>>>>$element\n"; |
|
528
|
0
|
0
|
|
|
|
|
if ($element eq "semantic_category") { |
|
529
|
|
|
|
|
|
|
# warn "+++++++++\n"; |
|
530
|
0
|
|
|
|
|
|
$nodetmp = $nodetmp->getChildrenByTagName("list_refid_ontology_node")->get_node(1); |
|
531
|
|
|
|
|
|
|
} |
|
532
|
0
|
|
|
|
|
|
foreach $inner_node ($nodetmp->childNodes) { |
|
533
|
|
|
|
|
|
|
# warn "====\n"; |
|
534
|
|
|
|
|
|
|
# warn " " . $inner_node->nodeName . "\n"; |
|
535
|
0
|
0
|
|
|
|
|
if ($inner_node->hasChildNodes) { |
|
536
|
0
|
|
|
|
|
|
$inner_element = $inner_node->nodeName; |
|
537
|
|
|
|
|
|
|
# warn $inner_node->nodeName . " ($element -- 3):" . $inner_node->textContent . "\n"; |
|
538
|
0
|
0
|
|
|
|
|
if ($inner_node->hasAttributes) { |
|
539
|
0
|
|
|
|
|
|
my @tmp = $inner_node->attributes(); |
|
540
|
0
|
|
|
|
|
|
foreach my $a (@tmp) { |
|
541
|
|
|
|
|
|
|
# warn "\tAttributes: " . ($a->getValue) . "\n"; |
|
542
|
|
|
|
|
|
|
# warn "\tAttributes: " . ($a->getName) . "\n"; |
|
543
|
0
|
|
|
|
|
|
$values_h{$a->getValue} = $inner_node->textContent; |
|
544
|
|
|
|
|
|
|
} |
|
545
|
|
|
|
|
|
|
} else { |
|
546
|
0
|
0
|
|
|
|
|
if ($element eq "semantic_category") { |
|
547
|
0
|
|
|
|
|
|
my @semf = split /\//, $inner_node->textContent; |
|
548
|
0
|
|
|
|
|
|
push @values_t, \@semf; |
|
549
|
|
|
|
|
|
|
} else { |
|
550
|
0
|
|
|
|
|
|
push @values_t, $inner_node->textContent; |
|
551
|
|
|
|
|
|
|
} |
|
552
|
|
|
|
|
|
|
} |
|
553
|
|
|
|
|
|
|
} |
|
554
|
|
|
|
|
|
|
} |
|
555
|
0
|
0
|
|
|
|
|
if (scalar(@values_t) == 0) { |
|
556
|
0
|
|
|
|
|
|
$fields->{$element} = \%values_h; |
|
557
|
|
|
|
|
|
|
} else { |
|
558
|
0
|
0
|
0
|
|
|
|
if (($element eq "list_refid_components") || |
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
($element eq "list_refid_semantic_unit") || |
|
560
|
|
|
|
|
|
|
($element eq "list_refid_ontology_node")) { |
|
561
|
|
|
|
|
|
|
# warn ">>>>$inner_element\n"; |
|
562
|
0
|
|
|
|
|
|
$fields->{$inner_element} = \@values_t; |
|
563
|
|
|
|
|
|
|
} elsif ($element eq "refid_head") { |
|
564
|
0
|
|
|
|
|
|
$fields->{$inner_element. "_head"} = \@values_t; |
|
565
|
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
} elsif ($element eq "refid_modifier") { |
|
567
|
0
|
|
|
|
|
|
$fields->{$inner_element. "_modifier"} = \@values_t; |
|
568
|
|
|
|
|
|
|
} else { |
|
569
|
0
|
|
|
|
|
|
$fields->{$element} = \@values_t; |
|
570
|
|
|
|
|
|
|
} |
|
571
|
|
|
|
|
|
|
} |
|
572
|
|
|
|
|
|
|
# } |
|
573
|
|
|
|
|
|
|
} |
|
574
|
|
|
|
|
|
|
} else { |
|
575
|
0
|
|
|
|
|
|
$fields->{$element} = $nodes[0]->textContent; |
|
576
|
|
|
|
|
|
|
} |
|
577
|
|
|
|
|
|
|
} |
|
578
|
|
|
|
|
|
|
} |
|
579
|
|
|
|
|
|
|
# $fields->{$element} = $node->getChildrenByTagName($element)->get_node(1)->textContent; |
|
580
|
|
|
|
|
|
|
# warn "--------------------\n"; |
|
581
|
|
|
|
|
|
|
} |
|
582
|
0
|
|
|
|
|
|
push @nodeList, $fields; |
|
583
|
|
|
|
|
|
|
# $self->addWord(Lingua::Ogmios::Annotations::Word->new($fields)); |
|
584
|
|
|
|
|
|
|
} |
|
585
|
0
|
|
|
|
|
|
warn "Loading $level_node done\n"; |
|
586
|
|
|
|
|
|
|
} |
|
587
|
0
|
|
|
|
|
|
return(@nodeList); |
|
588
|
|
|
|
|
|
|
} |
|
589
|
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
sub load_WordLevel { |
|
591
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
592
|
|
|
|
|
|
|
|
|
593
|
0
|
|
|
|
|
|
my @nodeList; |
|
594
|
|
|
|
|
|
|
my $fields; |
|
595
|
0
|
|
|
|
|
|
my $token; |
|
596
|
0
|
|
|
|
|
|
my @token_list; |
|
597
|
|
|
|
|
|
|
|
|
598
|
0
|
|
|
|
|
|
warn "[LOG] Word Level Loading\n"; |
|
599
|
|
|
|
|
|
|
|
|
600
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "word_level", 'word', $self->getWordLevel->getXMLorder); |
|
601
|
|
|
|
|
|
|
|
|
602
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
603
|
|
|
|
|
|
|
|
|
604
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
605
|
|
|
|
|
|
|
# my @token_list; |
|
606
|
|
|
|
|
|
|
# foreach $token (@{$fields->{'list_refid_token'}}) { |
|
607
|
|
|
|
|
|
|
# push @token_list, $self->getTokenLevel->getElementById($token); |
|
608
|
|
|
|
|
|
|
# } |
|
609
|
|
|
|
|
|
|
# $fields->{'list_refid_token'} = \@token_list; |
|
610
|
|
|
|
|
|
|
|
|
611
|
0
|
|
|
|
|
|
$self->addWord(Lingua::Ogmios::Annotations::Word->new($fields)); |
|
612
|
|
|
|
|
|
|
} |
|
613
|
|
|
|
|
|
|
|
|
614
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
615
|
|
|
|
|
|
|
} |
|
616
|
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
# sub load_WordLevel1 { |
|
618
|
|
|
|
|
|
|
# my ($self, $linguistic_analysis_node) = @_; |
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
# my $word_node; |
|
621
|
|
|
|
|
|
|
# my $XML_order = $self->getWordLevel->getXMLorder; |
|
622
|
|
|
|
|
|
|
# my $element; |
|
623
|
|
|
|
|
|
|
# my $word; |
|
624
|
|
|
|
|
|
|
# my $fields; |
|
625
|
|
|
|
|
|
|
# my @nodes; |
|
626
|
|
|
|
|
|
|
# my $node; |
|
627
|
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
# my $word_level_node = $linguistic_analysis_node->getChildrenByTagName('word_level')->get_node(1); |
|
629
|
|
|
|
|
|
|
# if (defined $word_level_node) { |
|
630
|
|
|
|
|
|
|
# warn "Loading Word Level\n"; |
|
631
|
|
|
|
|
|
|
# warn " " . $word_level_node->getChildrenByTagName('word')->size . " to load\n"; |
|
632
|
|
|
|
|
|
|
# foreach $word_node ($word_level_node->getChildrenByTagName('word')) { |
|
633
|
|
|
|
|
|
|
# $fields = {}; |
|
634
|
|
|
|
|
|
|
# foreach $element (@$XML_order) { |
|
635
|
|
|
|
|
|
|
# # warn "element: $element\n"; |
|
636
|
|
|
|
|
|
|
# @nodes = $word_node->getChildrenByTagName($element); |
|
637
|
|
|
|
|
|
|
# # warn "\tnb nodes: " . scalar(@nodes) . "\n"; |
|
638
|
|
|
|
|
|
|
# if (scalar(@nodes) > 1) { |
|
639
|
|
|
|
|
|
|
# # warn "===\n"; |
|
640
|
|
|
|
|
|
|
# my @values; |
|
641
|
|
|
|
|
|
|
# foreach $node (@nodes) { |
|
642
|
|
|
|
|
|
|
# # warn "$element (1):" . $node->textContent . "\n"; |
|
643
|
|
|
|
|
|
|
# push @values, $node->textContent; |
|
644
|
|
|
|
|
|
|
# } |
|
645
|
|
|
|
|
|
|
# $fields->{$element} = \@values; |
|
646
|
|
|
|
|
|
|
# } else { |
|
647
|
|
|
|
|
|
|
# if (scalar(@nodes) == 1) { |
|
648
|
|
|
|
|
|
|
# # warn " => " . $nodes[0]->nodeName . "\n"; |
|
649
|
|
|
|
|
|
|
# # warn "$element (2): " . $nodes[0]->hasChildNodes . "\n"; |
|
650
|
|
|
|
|
|
|
# # warn "$element (2): " . $nodes[0]->textContent . "\n"; |
|
651
|
|
|
|
|
|
|
# # childNodes |
|
652
|
|
|
|
|
|
|
# if ($nodes[0]->hasChildNodes) { |
|
653
|
|
|
|
|
|
|
# my @values; |
|
654
|
|
|
|
|
|
|
# # warn "=> " . $nodes[0]->childNodes . "\n"; |
|
655
|
|
|
|
|
|
|
# # warn "=>(NT) " . $nodes[0]->nodeType . "\n"; |
|
656
|
|
|
|
|
|
|
# if ((scalar(@{$nodes[0]->childNodes}) == 1) && ($nodes[0]->childNodes->get_node(1)->nodeName eq "#text")){ |
|
657
|
|
|
|
|
|
|
# # warn $nodes[0]->childNodes->[0]->textContent . "\n"; |
|
658
|
|
|
|
|
|
|
# $fields->{$element} = $nodes[0]->childNodes->get_node(1)->textContent; |
|
659
|
|
|
|
|
|
|
# } else { |
|
660
|
|
|
|
|
|
|
# foreach $node ($nodes[0]->childNodes) { |
|
661
|
|
|
|
|
|
|
# # warn "====\n"; |
|
662
|
|
|
|
|
|
|
# # warn " " . $node->nodeName . "\n"; |
|
663
|
|
|
|
|
|
|
# if ($node->hasChildNodes) { |
|
664
|
|
|
|
|
|
|
# # warn $node->nodeName . " (3):" . $node->textContent . "\n"; |
|
665
|
|
|
|
|
|
|
# # warn " (NT) " . $node->nodeType . "\n"; |
|
666
|
|
|
|
|
|
|
# push @values, $node->textContent; |
|
667
|
|
|
|
|
|
|
# } |
|
668
|
|
|
|
|
|
|
# } |
|
669
|
|
|
|
|
|
|
# $fields->{$element} = \@values; |
|
670
|
|
|
|
|
|
|
# } |
|
671
|
|
|
|
|
|
|
# } else { |
|
672
|
|
|
|
|
|
|
# $fields->{$element} = $nodes[0]->textContent; |
|
673
|
|
|
|
|
|
|
# } |
|
674
|
|
|
|
|
|
|
# } |
|
675
|
|
|
|
|
|
|
# } |
|
676
|
|
|
|
|
|
|
# # $fields->{$element} = $word_node->getChildrenByTagName($element)->get_node(1)->textContent; |
|
677
|
|
|
|
|
|
|
# # warn "--------------------\n"; |
|
678
|
|
|
|
|
|
|
# } |
|
679
|
|
|
|
|
|
|
# $self->addWord(Lingua::Ogmios::Annotations::Word->new($fields)); |
|
680
|
|
|
|
|
|
|
# } |
|
681
|
|
|
|
|
|
|
# warn "done\n"; |
|
682
|
|
|
|
|
|
|
# } |
|
683
|
|
|
|
|
|
|
# } |
|
684
|
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
sub load_PhraseLevel { |
|
686
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
687
|
|
|
|
|
|
|
|
|
688
|
0
|
|
|
|
|
|
my @nodeList; |
|
689
|
|
|
|
|
|
|
my $fields; |
|
690
|
|
|
|
|
|
|
|
|
691
|
0
|
|
|
|
|
|
my $element; |
|
692
|
0
|
|
|
|
|
|
my $elemnt_list; |
|
693
|
|
|
|
|
|
|
|
|
694
|
0
|
|
|
|
|
|
warn "[LOG] Phrase Level Loading\n"; |
|
695
|
|
|
|
|
|
|
|
|
696
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "phrase_level", 'phrase', $self->getPhraseLevel->getXMLorder); |
|
697
|
|
|
|
|
|
|
|
|
698
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
699
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
700
|
0
|
|
|
|
|
|
$self->addPhrase(Lingua::Ogmios::Annotations::Phrase->new($fields)); |
|
701
|
|
|
|
|
|
|
} |
|
702
|
|
|
|
|
|
|
|
|
703
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
704
|
|
|
|
|
|
|
} |
|
705
|
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
sub load_EnumerationLevel { |
|
707
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
708
|
|
|
|
|
|
|
|
|
709
|
0
|
|
|
|
|
|
my @nodeList; |
|
710
|
|
|
|
|
|
|
my $fields; |
|
711
|
|
|
|
|
|
|
|
|
712
|
0
|
|
|
|
|
|
my $element; |
|
713
|
0
|
|
|
|
|
|
my $elemnt_list; |
|
714
|
|
|
|
|
|
|
|
|
715
|
0
|
|
|
|
|
|
warn "[LOG] Enumeration Level Loading (CODE NOT CHECK)\n"; |
|
716
|
|
|
|
|
|
|
|
|
717
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "enumeration_level", 'enumeration', $self->getEnumerationLevel->getXMLorder); |
|
718
|
|
|
|
|
|
|
|
|
719
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
720
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
721
|
0
|
|
|
|
|
|
$self->addEnumeration(Lingua::Ogmios::Annotations::Enumeration->new($fields)); |
|
722
|
|
|
|
|
|
|
} |
|
723
|
|
|
|
|
|
|
|
|
724
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
725
|
|
|
|
|
|
|
} |
|
726
|
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
sub load_SentenceLevel { |
|
728
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
729
|
|
|
|
|
|
|
|
|
730
|
0
|
|
|
|
|
|
my @nodeList; |
|
731
|
|
|
|
|
|
|
my $fields; |
|
732
|
|
|
|
|
|
|
|
|
733
|
0
|
|
|
|
|
|
warn "[LOG] Sentence Level Loading\n"; |
|
734
|
|
|
|
|
|
|
|
|
735
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "sentence_level", 'sentence', $self->getSentenceLevel->getXMLorder); |
|
736
|
|
|
|
|
|
|
|
|
737
|
0
|
|
|
|
|
|
warn "Make Sentences (" . scalar(@nodeList) . ")\n"; |
|
738
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
739
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
740
|
0
|
|
|
|
|
|
$self->addSentence(Lingua::Ogmios::Annotations::Sentence->new($fields)); |
|
741
|
|
|
|
|
|
|
} |
|
742
|
|
|
|
|
|
|
|
|
743
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
744
|
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
} |
|
746
|
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
sub load_Syntactic_relationLevel { |
|
748
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
749
|
|
|
|
|
|
|
|
|
750
|
0
|
|
|
|
|
|
my @nodeList; |
|
751
|
|
|
|
|
|
|
my $fields; |
|
752
|
|
|
|
|
|
|
|
|
753
|
0
|
|
|
|
|
|
my $element; |
|
754
|
0
|
|
|
|
|
|
my $elemnt_list; |
|
755
|
|
|
|
|
|
|
|
|
756
|
0
|
|
|
|
|
|
warn "[LOG] Syntatic Relation Level Loading\n"; |
|
757
|
|
|
|
|
|
|
|
|
758
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "syntactic_relation_level", 'syntactic_relation', $self->getSyntacticRelationLevel->getXMLorder); |
|
759
|
|
|
|
|
|
|
|
|
760
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
761
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
762
|
0
|
|
|
|
|
|
$self->addSyntacticRelation(Lingua::Ogmios::Annotations::SyntacticRelation->new($fields)); |
|
763
|
|
|
|
|
|
|
} |
|
764
|
|
|
|
|
|
|
|
|
765
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
766
|
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
} |
|
768
|
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
sub load_Semantic_unitLevel { |
|
770
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
771
|
|
|
|
|
|
|
|
|
772
|
0
|
|
|
|
|
|
my @nodeList; |
|
773
|
|
|
|
|
|
|
my $fields; |
|
774
|
0
|
|
|
|
|
|
my $type; |
|
775
|
|
|
|
|
|
|
|
|
776
|
0
|
|
|
|
|
|
warn "[LOG] Semantic Unit Level Loading\n"; |
|
777
|
|
|
|
|
|
|
|
|
778
|
0
|
|
|
|
|
|
for $type ('named_entity', 'term', 'undefined') { |
|
779
|
|
|
|
|
|
|
# 'semantic_unit' |
|
780
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "semantic_unit_level", $type, $self->getSemanticUnitLevel->getXMLorder); |
|
781
|
|
|
|
|
|
|
|
|
782
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
783
|
|
|
|
|
|
|
# print STDERR Dumper($fields) . "\n"; |
|
784
|
0
|
|
|
|
|
|
$fields->{'type'} = $type; |
|
785
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
786
|
0
|
|
|
|
|
|
$self->addSemanticUnit(Lingua::Ogmios::Annotations::SemanticUnit->new($fields)); |
|
787
|
|
|
|
|
|
|
} |
|
788
|
|
|
|
|
|
|
} |
|
789
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
790
|
|
|
|
|
|
|
} |
|
791
|
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
sub load_Domain_specific_relationLevel { |
|
793
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
794
|
|
|
|
|
|
|
|
|
795
|
0
|
|
|
|
|
|
my @nodeList; |
|
796
|
|
|
|
|
|
|
my $fields; |
|
797
|
|
|
|
|
|
|
|
|
798
|
0
|
|
|
|
|
|
my $element; |
|
799
|
0
|
|
|
|
|
|
my $elemnt_list; |
|
800
|
|
|
|
|
|
|
|
|
801
|
0
|
|
|
|
|
|
warn "[LOG] Domain Specific Relation Level Loading (CODE NOT CHECK)\n"; |
|
802
|
|
|
|
|
|
|
|
|
803
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "domain_specific_relation_level", 'domain_specific_relation', $self->getDomainSpecificRelationLevel->getXMLorder); |
|
804
|
|
|
|
|
|
|
|
|
805
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
806
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
807
|
0
|
|
|
|
|
|
$self->addDomainSpecificRelation(Lingua::Ogmios::Annotations::DomainSpecificRelation->new($fields)); |
|
808
|
|
|
|
|
|
|
} |
|
809
|
|
|
|
|
|
|
|
|
810
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
811
|
|
|
|
|
|
|
} |
|
812
|
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
sub load_Anaphora_relationLevel { |
|
814
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
815
|
|
|
|
|
|
|
|
|
816
|
0
|
|
|
|
|
|
my @nodeList; |
|
817
|
|
|
|
|
|
|
my $fields; |
|
818
|
|
|
|
|
|
|
|
|
819
|
0
|
|
|
|
|
|
my $element; |
|
820
|
0
|
|
|
|
|
|
my $elemnt_list; |
|
821
|
|
|
|
|
|
|
|
|
822
|
0
|
|
|
|
|
|
warn "[LOG] Anaphora Relation Level Loading (CODE NOT CHECK)\n"; |
|
823
|
|
|
|
|
|
|
|
|
824
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "anaphora_relation_level", 'anaphora_relation', $self->getAnaphoraRelationLevel->getXMLorder); |
|
825
|
|
|
|
|
|
|
|
|
826
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
827
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
828
|
0
|
|
|
|
|
|
$self->addAnaphoraRelation(Lingua::Ogmios::Annotations::AnaphoraRelation->new($fields)); |
|
829
|
|
|
|
|
|
|
} |
|
830
|
|
|
|
|
|
|
|
|
831
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
832
|
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
} |
|
834
|
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
sub load_LemmaLevel { |
|
836
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
837
|
|
|
|
|
|
|
|
|
838
|
0
|
|
|
|
|
|
my @nodeList; |
|
839
|
|
|
|
|
|
|
my $fields; |
|
840
|
|
|
|
|
|
|
|
|
841
|
0
|
|
|
|
|
|
warn "[LOG] Lemma Level Loading\n"; |
|
842
|
|
|
|
|
|
|
|
|
843
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "lemma_level", 'lemma', $self->getLemmaLevel->getXMLorder); |
|
844
|
|
|
|
|
|
|
|
|
845
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
846
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
847
|
0
|
|
|
|
|
|
$self->addLemma(Lingua::Ogmios::Annotations::Lemma->new($fields)); |
|
848
|
|
|
|
|
|
|
} |
|
849
|
|
|
|
|
|
|
|
|
850
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
851
|
|
|
|
|
|
|
} |
|
852
|
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
sub load_Morphosyntactic_featuresLevel { |
|
854
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
855
|
|
|
|
|
|
|
|
|
856
|
0
|
|
|
|
|
|
my @nodeList; |
|
857
|
|
|
|
|
|
|
my $fields; |
|
858
|
|
|
|
|
|
|
|
|
859
|
0
|
|
|
|
|
|
warn "[LOG] Morphosyntactic Features Level Loading\n"; |
|
860
|
|
|
|
|
|
|
|
|
861
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "morphosyntactic_features_level", 'morphosyntactic_features', $self->getMorphosyntacticFeaturesLevel->getXMLorder); |
|
862
|
|
|
|
|
|
|
|
|
863
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
864
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
865
|
0
|
|
|
|
|
|
$self->addMorphosyntacticFeatures(Lingua::Ogmios::Annotations::MorphosyntacticFeatures->new($fields)); |
|
866
|
|
|
|
|
|
|
} |
|
867
|
|
|
|
|
|
|
|
|
868
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
869
|
|
|
|
|
|
|
} |
|
870
|
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
sub load_Semantic_featuresLevel { |
|
872
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
873
|
|
|
|
|
|
|
|
|
874
|
0
|
|
|
|
|
|
my @nodeList; |
|
875
|
|
|
|
|
|
|
my $fields; |
|
876
|
|
|
|
|
|
|
|
|
877
|
0
|
|
|
|
|
|
my $element; |
|
878
|
0
|
|
|
|
|
|
my $elemnt_list; |
|
879
|
|
|
|
|
|
|
|
|
880
|
0
|
|
|
|
|
|
warn "[LOG] Semantic Features Level Loading\n"; |
|
881
|
|
|
|
|
|
|
|
|
882
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "semantic_features_level", 'semantic_features', $self->getSemanticFeaturesLevel->getXMLorder); |
|
883
|
|
|
|
|
|
|
|
|
884
|
0
|
|
|
|
|
|
warn "Make Semantic Features (" . scalar(@nodeList) . ")\n"; |
|
885
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
886
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
887
|
|
|
|
|
|
|
# warn ref($fields->{'semantic_category'}) . "\n"; |
|
888
|
0
|
0
|
|
|
|
|
if (ref($fields->{'semantic_category'}) eq "ARRAY") { |
|
889
|
0
|
|
|
|
|
|
$self->addSemanticFeatures(Lingua::Ogmios::Annotations::SemanticFeatures->new($fields)); |
|
890
|
|
|
|
|
|
|
} |
|
891
|
|
|
|
|
|
|
} |
|
892
|
|
|
|
|
|
|
|
|
893
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
894
|
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
} |
|
896
|
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
sub load_StemLevel { |
|
898
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
899
|
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
|
|
901
|
0
|
|
|
|
|
|
my @nodeList; |
|
902
|
|
|
|
|
|
|
my $fields; |
|
903
|
|
|
|
|
|
|
|
|
904
|
0
|
|
|
|
|
|
warn "[LOG] Stem Level Loading\n"; |
|
905
|
|
|
|
|
|
|
|
|
906
|
0
|
|
|
|
|
|
@nodeList = $self->load_Level($linguistic_analysis_node, "stem_level", 'stem', $self->getStemLevel->getXMLorder); |
|
907
|
|
|
|
|
|
|
|
|
908
|
0
|
|
|
|
|
|
foreach $fields (@nodeList) { |
|
909
|
0
|
|
|
|
|
|
$self->makeElementRefFromId($fields); |
|
910
|
0
|
|
|
|
|
|
$self->addStem(Lingua::Ogmios::Annotations::Stem->new($fields)); |
|
911
|
|
|
|
|
|
|
} |
|
912
|
|
|
|
|
|
|
|
|
913
|
0
|
|
|
|
|
|
warn "\tdone\n"; |
|
914
|
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
} |
|
916
|
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
sub loadLinguisticAnalysis { |
|
918
|
0
|
|
|
0
|
0
|
|
my ($self, $linguistic_analysis_node) = @_; |
|
919
|
|
|
|
|
|
|
# my ($self, $document_record_node) = @_; |
|
920
|
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
# my $linguistic_analysis_node = $document_record_node->getChildrenByTagName('linguisticAnalysis')->get_node(1); |
|
922
|
|
|
|
|
|
|
|
|
923
|
0
|
0
|
|
|
|
|
if (defined $linguistic_analysis_node) { |
|
924
|
0
|
|
|
|
|
|
warn "Load existing linguistic annotations\n"; |
|
925
|
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
# load token level |
|
927
|
0
|
|
|
|
|
|
$self->load_TokenLevel($linguistic_analysis_node); |
|
928
|
0
|
|
|
|
|
|
$self->load_WordLevel($linguistic_analysis_node); |
|
929
|
0
|
|
|
|
|
|
$self->load_PhraseLevel($linguistic_analysis_node); |
|
930
|
0
|
|
|
|
|
|
$self->load_SentenceLevel($linguistic_analysis_node); |
|
931
|
0
|
|
|
|
|
|
$self->load_Semantic_unitLevel($linguistic_analysis_node); |
|
932
|
0
|
|
|
|
|
|
$self->load_LemmaLevel($linguistic_analysis_node); |
|
933
|
0
|
|
|
|
|
|
$self->load_LogLevel($linguistic_analysis_node); |
|
934
|
0
|
|
|
|
|
|
$self->load_Morphosyntactic_featuresLevel($linguistic_analysis_node); |
|
935
|
0
|
|
|
|
|
|
$self->load_StemLevel($linguistic_analysis_node); |
|
936
|
0
|
|
|
|
|
|
$self->load_Syntactic_relationLevel($linguistic_analysis_node); |
|
937
|
0
|
|
|
|
|
|
$self->load_Semantic_featuresLevel($linguistic_analysis_node); |
|
938
|
0
|
|
|
|
|
|
$self->load_EnumerationLevel($linguistic_analysis_node); |
|
939
|
0
|
|
|
|
|
|
$self->load_Domain_specific_relationLevel($linguistic_analysis_node); |
|
940
|
0
|
|
|
|
|
|
$self->load_Anaphora_relationLevel($linguistic_analysis_node); |
|
941
|
|
|
|
|
|
|
} |
|
942
|
|
|
|
|
|
|
} |
|
943
|
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
sub loadCanonicalDocument { |
|
946
|
0
|
|
|
0
|
0
|
|
my ($self, $acquisition_section_node) = @_; |
|
947
|
|
|
|
|
|
|
|
|
948
|
0
|
|
|
|
|
|
my $canonical_document; |
|
949
|
|
|
|
|
|
|
my $canonical_document_section_positions; |
|
950
|
0
|
|
|
|
|
|
my $canonical_document_node = $acquisition_section_node->getChildrenByTagName('canonicalDocument')->get_node(1); |
|
951
|
0
|
|
|
|
|
|
my $section; |
|
952
|
|
|
|
|
|
|
|
|
953
|
0
|
0
|
|
|
|
|
if (defined $canonical_document_node) { |
|
954
|
0
|
|
|
|
|
|
($canonical_document, $canonical_document_section_positions) = $self->_parseCanonicalDocument($canonical_document_node); |
|
955
|
0
|
|
|
|
|
|
$self->setCanonicalDocument($canonical_document); |
|
956
|
0
|
|
|
|
|
|
foreach $section (@$canonical_document_section_positions) { |
|
957
|
0
|
|
|
|
|
|
$self->addSection($section); |
|
958
|
0
|
0
|
|
|
|
|
warn "section from " . $section->getFrom . " to " . $section->getTo . "\n" unless $debug_devel_level != 1; |
|
959
|
|
|
|
|
|
|
} |
|
960
|
|
|
|
|
|
|
# $self->setCanonicalDocument_SectionPosition($canonical_document_section_positions); |
|
961
|
|
|
|
|
|
|
} else { |
|
962
|
0
|
|
|
|
|
|
warn "no canonicalDocument (" . $self->getId . ")\n"; |
|
963
|
|
|
|
|
|
|
} |
|
964
|
|
|
|
|
|
|
} |
|
965
|
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
sub _parseCanonicalDocument_SectionPosition { |
|
967
|
|
|
|
|
|
|
|
|
968
|
0
|
|
|
0
|
|
|
my ($self, $canonical_document_node) = @_; |
|
969
|
|
|
|
|
|
|
|
|
970
|
0
|
|
|
|
|
|
my @sections; |
|
971
|
0
|
|
|
|
|
|
my $canonicalDocumentString = ""; |
|
972
|
|
|
|
|
|
|
|
|
973
|
0
|
|
|
|
|
|
return(\@sections); |
|
974
|
|
|
|
|
|
|
} |
|
975
|
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
sub _parseCanonicalDocument { |
|
978
|
|
|
|
|
|
|
|
|
979
|
0
|
|
|
0
|
|
|
my ($self, $canonical_document_node) = @_; |
|
980
|
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
# warn "in parseCanonicalDocument\n"; |
|
982
|
|
|
|
|
|
|
|
|
983
|
0
|
|
|
|
|
|
my @sections; |
|
984
|
|
|
|
|
|
|
my @section_starts; |
|
985
|
0
|
|
|
|
|
|
my @section_ends; |
|
986
|
0
|
|
|
|
|
|
my $canonicalDocumentString = ""; |
|
987
|
0
|
|
|
|
|
|
my @canonicalDocument_sections; |
|
988
|
|
|
|
|
|
|
my $section; |
|
989
|
0
|
|
|
|
|
|
my $start_position; |
|
990
|
0
|
|
|
|
|
|
my $end_position; |
|
991
|
|
|
|
|
|
|
|
|
992
|
0
|
|
|
|
|
|
my $i; |
|
993
|
|
|
|
|
|
|
|
|
994
|
0
|
|
|
|
|
|
$canonicalDocumentString = $canonical_document_node->toString; |
|
995
|
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
|
|
997
|
0
|
|
|
|
|
|
$canonicalDocumentString =~ s/[\s\n]*<\/?canonicalDocument>\s*//go; |
|
998
|
|
|
|
|
|
|
|
|
999
|
0
|
|
|
|
|
|
my $temp_canonicalDocumentString = $canonicalDocumentString; |
|
1000
|
|
|
|
|
|
|
|
|
1001
|
0
|
|
|
|
|
|
my @section_infos; |
|
1002
|
|
|
|
|
|
|
my $section_string; |
|
1003
|
|
|
|
|
|
|
|
|
1004
|
0
|
|
|
|
|
|
while($temp_canonicalDocumentString =~ / |
|
1005
|
0
|
|
|
|
|
|
push @canonicalDocument_sections, $`; #` } |
|
1006
|
0
|
|
|
|
|
|
$temp_canonicalDocumentString = $'; |
|
1007
|
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
|
|
1009
|
0
|
|
|
|
|
|
$section_string = $&; # ' |
|
1010
|
|
|
|
|
|
|
# warn "section string: $section_string\n"; |
|
1011
|
|
|
|
|
|
|
# warn $temp_canonicalDocumentString . "\n\n"; |
|
1012
|
0
|
|
|
|
|
|
my %tmp; |
|
1013
|
0
|
|
|
|
|
|
$tmp{'type'} = "empty"; |
|
1014
|
0
|
|
|
|
|
|
$tmp{'title'} = "empty"; |
|
1015
|
0
|
0
|
|
|
|
|
if ($section_string =~ /- /o) {
|
|
1016
|
0
|
|
|
|
|
|
$tmp{'type'} = "item"; |
|
1017
|
0
|
|
|
|
|
|
$tmp{'title'} = undef; |
|
1018
|
|
|
|
|
|
|
} else { |
|
1019
|
0
|
0
|
|
|
|
|
if ($section_string =~ //o) { |
|
1020
|
0
|
|
|
|
|
|
$tmp{'type'} = "list"; |
|
1021
|
0
|
|
|
|
|
|
$tmp{'title'} = undef; |
|
1022
|
|
|
|
|
|
|
} else { |
|
1023
|
0
|
|
|
|
|
|
$tmp{'type'} = "narrative"; |
|
1024
|
0
|
0
|
|
|
|
|
if ($section_string =~ /[^"]+)\")?(\s+title=\"(?[^"]+)\")?>/o) { #" |
|
1025
|
0
|
|
|
|
|
|
$tmp{'type'} = $+{st}; |
|
1026
|
0
|
|
|
|
|
|
$tmp{'title'} = $+{t}; |
|
1027
|
|
|
|
|
|
|
} else { |
|
1028
|
0
|
|
|
|
|
|
$tmp{'title'} = undef; |
|
1029
|
|
|
|
|
|
|
} |
|
1030
|
|
|
|
|
|
|
} |
|
1031
|
|
|
|
|
|
|
} |
|
1032
|
0
|
|
|
|
|
|
push @section_infos, \%tmp; |
|
1033
|
|
|
|
|
|
|
} |
|
1034
|
0
|
|
|
|
|
|
push @canonicalDocument_sections, $temp_canonicalDocumentString; |
|
1035
|
|
|
|
|
|
|
|
|
1036
|
0
|
|
|
|
|
|
shift @canonicalDocument_sections; # what is before the first section cannot be into the document |
|
1037
|
|
|
|
|
|
|
|
|
1038
|
|
|
|
|
|
|
# shift @section_infos; |
|
1039
|
|
|
|
|
|
|
|
|
1040
|
0
|
|
|
|
|
|
$start_position = 0; |
|
1041
|
0
|
|
|
|
|
|
$end_position = 0; |
|
1042
|
|
|
|
|
|
|
|
|
1043
|
0
|
|
|
|
|
|
warn "[LOG] Identifying start position of the sections\n"; |
|
1044
|
|
|
|
|
|
|
|
|
1045
|
0
|
|
|
|
|
|
my $j; |
|
1046
|
0
|
|
|
|
|
|
for($j=0;$j < scalar(@canonicalDocument_sections);$j++) { |
|
1047
|
0
|
|
|
|
|
|
$section = $canonicalDocument_sections[$j]; |
|
1048
|
|
|
|
|
|
|
# warn "-> $section\n"; |
|
1049
|
|
|
|
|
|
|
# push @section_starts, $start_position; |
|
1050
|
0
|
|
|
|
|
|
my @tmp = ($start_position, $section_infos[$j], $section); |
|
1051
|
0
|
|
|
|
|
|
push @section_starts, \@tmp; |
|
1052
|
0
|
|
|
|
|
|
$section =~ s/<[^>]+>//go; |
|
1053
|
|
|
|
|
|
|
# warn "$section\n"; |
|
1054
|
|
|
|
|
|
|
# warn "\t" . length(Lingua::Ogmios::Annotations::Element->_xmldecode($section)) . "\n"; |
|
1055
|
0
|
|
|
|
|
|
$start_position += length(Lingua::Ogmios::Annotations::Element->_xmldecode($section)); |
|
1056
|
|
|
|
|
|
|
# warn "\t" . $start_position . "\n"; |
|
1057
|
|
|
|
|
|
|
} |
|
1058
|
|
|
|
|
|
|
|
|
1059
|
0
|
|
|
|
|
|
warn "\n[LOG] Identifying end position of the sections\n"; |
|
1060
|
|
|
|
|
|
|
|
|
1061
|
0
|
|
|
|
|
|
@canonicalDocument_sections = split m!||!, $canonicalDocumentString; |
|
1062
|
|
|
|
|
|
|
|
|
1063
|
0
|
|
|
|
|
|
foreach $section (@canonicalDocument_sections) { |
|
1064
|
0
|
0
|
|
|
|
|
if ($section eq "") { |
|
1065
|
|
|
|
|
|
|
# warn "empty section content ($end_position)\n"; |
|
1066
|
0
|
0
|
|
|
|
|
if ($end_position != 0) { |
|
1067
|
0
|
|
|
|
|
|
push @section_ends, $end_position-1; |
|
1068
|
|
|
|
|
|
|
} else { |
|
1069
|
0
|
|
|
|
|
|
push @section_ends, $end_position; |
|
1070
|
|
|
|
|
|
|
} |
|
1071
|
|
|
|
|
|
|
} else { |
|
1072
|
|
|
|
|
|
|
# warn "-> $section\n"; |
|
1073
|
|
|
|
|
|
|
# warn "\t" . $end_position . "(a)\n"; |
|
1074
|
|
|
|
|
|
|
# if ($section =~ /([^<]*)<[^>]+>/os) { |
|
1075
|
|
|
|
|
|
|
# $end_position += length($1); |
|
1076
|
|
|
|
|
|
|
# } |
|
1077
|
0
|
|
|
|
|
|
while($section =~ s/([^<]*)<[^>]+>//os) { |
|
1078
|
0
|
|
|
|
|
|
$end_position += length($1); |
|
1079
|
|
|
|
|
|
|
} |
|
1080
|
|
|
|
|
|
|
# warn "\t" . $end_position . "(b)\n"; |
|
1081
|
|
|
|
|
|
|
# $section =~ s/<[^>]+>//go; |
|
1082
|
|
|
|
|
|
|
# warn "$section\n"; |
|
1083
|
|
|
|
|
|
|
# warn "\t" . length(Lingua::Ogmios::Annotations::Element->_xmldecode($section)) . "\n"; |
|
1084
|
0
|
|
|
|
|
|
$end_position += length(Lingua::Ogmios::Annotations::Element->_xmldecode($section)); |
|
1085
|
0
|
|
|
|
|
|
$end_position--; |
|
1086
|
|
|
|
|
|
|
# warn "\t" . $end_position . "(c)\n"; |
|
1087
|
0
|
|
|
|
|
|
push @section_ends, $end_position; |
|
1088
|
0
|
|
|
|
|
|
$end_position++; |
|
1089
|
|
|
|
|
|
|
# push @section_ends, $section_starts[$#section_ends + 1] + length(Lingua::Ogmios::Annotations::Element->_xmldecode($section)) - 1; |
|
1090
|
|
|
|
|
|
|
} |
|
1091
|
|
|
|
|
|
|
} |
|
1092
|
|
|
|
|
|
|
|
|
1093
|
|
|
|
|
|
|
# as empty trailing fields are deleted with split, put empty |
|
1094
|
|
|
|
|
|
|
# string instead to get the same number of start and end section |
|
1095
|
|
|
|
|
|
|
# position |
|
1096
|
|
|
|
|
|
|
|
|
1097
|
0
|
|
|
|
|
|
for($i = scalar(@section_ends); $i < scalar @section_starts; $i++) { |
|
1098
|
0
|
|
|
|
|
|
$section_ends[$i] = $section_ends[$#section_ends]; |
|
1099
|
|
|
|
|
|
|
} |
|
1100
|
|
|
|
|
|
|
|
|
1101
|
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
|
|
1103
|
0
|
|
|
|
|
|
$canonicalDocumentString =~ s/<[^>]+>//go; |
|
1104
|
|
|
|
|
|
|
|
|
1105
|
0
|
|
|
|
|
|
$canonicalDocumentString = Lingua::Ogmios::Annotations::Element->_xmldecode($canonicalDocumentString); |
|
1106
|
|
|
|
|
|
|
|
|
1107
|
0
|
|
|
|
|
|
warn "[LOG] Merging identification of the end and start position\n"; |
|
1108
|
0
|
|
|
|
|
|
$start_position = 0; |
|
1109
|
0
|
|
|
|
|
|
$end_position = 0; |
|
1110
|
0
|
|
|
|
|
|
&_merge_sections(\@section_starts, \@section_ends, \$start_position, \$end_position, \@sections, \@section_infos, 0, undef); |
|
1111
|
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
# if ($debug_devel_level == 1) { |
|
1113
|
|
|
|
|
|
|
# warn "[LOG/$debug_devel_level] Check merging identification of the end and start position\n"; |
|
1114
|
|
|
|
|
|
|
|
|
1115
|
|
|
|
|
|
|
# foreach $section (@sections) { |
|
1116
|
|
|
|
|
|
|
# ($start_position, $end_position) = ($section->getFrom, $section->getTo); |
|
1117
|
|
|
|
|
|
|
# warn "[LOG/$debug_devel_level] Section from $start_position to $end_position\n"; |
|
1118
|
|
|
|
|
|
|
# print STDERR "\t" . substr($canonicalDocumentString, $start_position, $end_position - $start_position + 1) . "\n"; |
|
1119
|
|
|
|
|
|
|
# } |
|
1120
|
|
|
|
|
|
|
# } |
|
1121
|
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
# exit; |
|
1123
|
|
|
|
|
|
|
|
|
1124
|
0
|
|
|
|
|
|
return($canonicalDocumentString, \@sections); |
|
1125
|
|
|
|
|
|
|
} |
|
1126
|
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
sub _merge_sections { |
|
1128
|
|
|
|
|
|
|
|
|
1129
|
0
|
|
|
0
|
|
|
my ($start_position_ref, $end_position_ref, $i_start_ref, $i_end_ref, $sections_ref, $section_infos_ref, $depth, $parent_section) = @_; |
|
1130
|
|
|
|
|
|
|
|
|
1131
|
0
|
|
|
|
|
|
my $section; |
|
1132
|
0
|
|
|
|
|
|
my $current_start_position = $$i_start_ref; |
|
1133
|
|
|
|
|
|
|
|
|
1134
|
0
|
|
|
|
|
|
my @child_sections; |
|
1135
|
|
|
|
|
|
|
my $i; |
|
1136
|
0
|
|
|
|
|
|
my $newparent_section; |
|
1137
|
0
|
|
|
|
|
|
my @created_sections; |
|
1138
|
|
|
|
|
|
|
|
|
1139
|
0
|
|
|
|
|
|
my $rank = 0; |
|
1140
|
|
|
|
|
|
|
|
|
1141
|
0
|
|
0
|
|
|
|
while(($$i_start_ref < scalar(@$start_position_ref)) && ($start_position_ref->[$$i_start_ref]->[0] < $end_position_ref->[$$i_end_ref])) { |
|
1142
|
0
|
|
|
|
|
|
$$i_start_ref++; |
|
1143
|
|
|
|
|
|
|
|
|
1144
|
0
|
|
|
|
|
|
my @tmp; |
|
1145
|
|
|
|
|
|
|
$section = Lingua::Ogmios::Annotations::Section->new({ |
|
1146
|
|
|
|
|
|
|
'from' => $start_position_ref->[$current_start_position]->[0], |
|
1147
|
|
|
|
|
|
|
'to' => $end_position_ref->[$$i_end_ref], |
|
1148
|
|
|
|
|
|
|
'title' => $start_position_ref->[$current_start_position]->[1]->{'title'}, |
|
1149
|
0
|
|
|
|
|
|
'type' => $start_position_ref->[$current_start_position]->[1]->{'type'}, |
|
1150
|
|
|
|
|
|
|
# 'title' => $section_infos_ref->[$current_start_position]->{'title'}, |
|
1151
|
|
|
|
|
|
|
# 'type' => $section_infos_ref->[$current_start_position]->{'type'}, |
|
1152
|
|
|
|
|
|
|
'parent_section' => $parent_section, |
|
1153
|
|
|
|
|
|
|
'child_sections' => \@tmp, |
|
1154
|
|
|
|
|
|
|
# 'child_sections' => \@child_sections, |
|
1155
|
|
|
|
|
|
|
'rank' => $rank++, |
|
1156
|
|
|
|
|
|
|
} |
|
1157
|
|
|
|
|
|
|
); |
|
1158
|
|
|
|
|
|
|
|
|
1159
|
0
|
|
|
|
|
|
push @created_sections, $section; |
|
1160
|
0
|
|
|
|
|
|
$newparent_section = $section; |
|
1161
|
|
|
|
|
|
|
|
|
1162
|
0
|
|
|
|
|
|
push @{$section->child_sections}, &_merge_sections($start_position_ref, $end_position_ref, $i_start_ref, $i_end_ref, $sections_ref, $section_infos_ref , $depth + 1, $newparent_section); |
|
|
0
|
|
|
|
|
|
|
|
1163
|
|
|
|
|
|
|
|
|
1164
|
0
|
|
|
|
|
|
$section->setTo($end_position_ref->[$$i_end_ref]); |
|
1165
|
0
|
|
|
|
|
|
push @$sections_ref, $section; |
|
1166
|
0
|
|
|
|
|
|
$current_start_position = $$i_start_ref; |
|
1167
|
|
|
|
|
|
|
|
|
1168
|
0
|
|
|
|
|
|
$$i_end_ref++; |
|
1169
|
|
|
|
|
|
|
|
|
1170
|
|
|
|
|
|
|
} |
|
1171
|
0
|
|
|
|
|
|
return(@created_sections); |
|
1172
|
|
|
|
|
|
|
} |
|
1173
|
|
|
|
|
|
|
|
|
1174
|
|
|
|
|
|
|
|
|
1175
|
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
sub getCanonicalDocument { |
|
1177
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1178
|
|
|
|
|
|
|
|
|
1179
|
0
|
|
|
|
|
|
return($self->{'canonical_document'}); |
|
1180
|
|
|
|
|
|
|
} |
|
1181
|
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
# sub setCanonicalDocument_SectionPosition { |
|
1183
|
|
|
|
|
|
|
# my ($self, $canonicalDocument_SectionPosition) = @_; |
|
1184
|
|
|
|
|
|
|
|
|
1185
|
|
|
|
|
|
|
# $self->{'canonical_document_section_position'} = $canonicalDocument_SectionPosition; |
|
1186
|
|
|
|
|
|
|
# } |
|
1187
|
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
# sub getCanonicalDocument_SectionPosition { |
|
1189
|
|
|
|
|
|
|
# my ($self) = @_; |
|
1190
|
|
|
|
|
|
|
|
|
1191
|
|
|
|
|
|
|
# return($self->{'canonical_document_section_position'}); |
|
1192
|
|
|
|
|
|
|
# } |
|
1193
|
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
sub setRelevanceSection { |
|
1195
|
0
|
|
|
0
|
0
|
|
my ($self, $relevance_section) = @_; |
|
1196
|
|
|
|
|
|
|
|
|
1197
|
0
|
|
|
|
|
|
$self->{'relevance_section'} = $relevance_section->toString; |
|
1198
|
|
|
|
|
|
|
} |
|
1199
|
|
|
|
|
|
|
|
|
1200
|
|
|
|
|
|
|
sub getRelevanceSection { |
|
1201
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1202
|
|
|
|
|
|
|
|
|
1203
|
0
|
|
|
|
|
|
return($self->{'relevance_section'}); |
|
1204
|
|
|
|
|
|
|
} |
|
1205
|
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
sub setAcquisitionSection { |
|
1207
|
0
|
|
|
0
|
0
|
|
my ($self, $acquisition_section) = @_; |
|
1208
|
|
|
|
|
|
|
|
|
1209
|
0
|
|
|
|
|
|
$self->{'acquisition_section'} = $acquisition_section->cloneNode(1); #->toString; |
|
1210
|
|
|
|
|
|
|
} |
|
1211
|
|
|
|
|
|
|
|
|
1212
|
|
|
|
|
|
|
sub getAcquisitionSection { |
|
1213
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1214
|
|
|
|
|
|
|
|
|
1215
|
0
|
|
|
|
|
|
return($self->{'acquisition_section'}); |
|
1216
|
|
|
|
|
|
|
} |
|
1217
|
|
|
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
sub getNamespace |
|
1219
|
|
|
|
|
|
|
{ |
|
1220
|
0
|
|
|
0
|
0
|
|
my $self; |
|
1221
|
0
|
0
|
|
|
|
|
if (UNIVERSAL::isa($_[0], 'Lingua::Ogmios::Annotations')) { |
|
1222
|
0
|
|
|
|
|
|
$self = shift; |
|
1223
|
|
|
|
|
|
|
} else { |
|
1224
|
0
|
|
|
|
|
|
$self = Lingua::Ogmios::Annotations->new; |
|
1225
|
|
|
|
|
|
|
} |
|
1226
|
0
|
|
|
|
|
|
my $file = shift; |
|
1227
|
|
|
|
|
|
|
|
|
1228
|
0
|
|
|
|
|
|
my $line; |
|
1229
|
0
|
|
|
|
|
|
my $xmlns = undef; |
|
1230
|
|
|
|
|
|
|
|
|
1231
|
0
|
|
|
|
|
|
open FILE, $file; |
|
1232
|
0
|
|
|
|
|
|
binmode(FILE); |
|
1233
|
|
|
|
|
|
|
|
|
1234
|
0
|
|
|
|
|
|
while(($line=)){ |
|
1235
|
0
|
0
|
|
|
|
|
if ($line =~ /xmlns=\"?([^\"]+)\"?/) { |
|
1236
|
0
|
|
|
|
|
|
$xmlns = $1; |
|
1237
|
0
|
|
|
|
|
|
next; |
|
1238
|
|
|
|
|
|
|
} |
|
1239
|
|
|
|
|
|
|
}; |
|
1240
|
0
|
|
|
|
|
|
close FILE; |
|
1241
|
|
|
|
|
|
|
|
|
1242
|
0
|
|
|
|
|
|
$self->setNamespace($xmlns); |
|
1243
|
|
|
|
|
|
|
|
|
1244
|
0
|
|
|
|
|
|
return($xmlns); |
|
1245
|
|
|
|
|
|
|
} |
|
1246
|
|
|
|
|
|
|
|
|
1247
|
|
|
|
|
|
|
sub setNamespace { |
|
1248
|
0
|
|
|
0
|
0
|
|
my ($self, $ns) = @_; |
|
1249
|
|
|
|
|
|
|
|
|
1250
|
0
|
|
|
|
|
|
$self->{"Namespace"} = $ns; |
|
1251
|
|
|
|
|
|
|
} |
|
1252
|
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
sub getSectionLevel { |
|
1254
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1255
|
|
|
|
|
|
|
|
|
1256
|
0
|
|
|
|
|
|
return($self->{'section_level'}); |
|
1257
|
|
|
|
|
|
|
} |
|
1258
|
|
|
|
|
|
|
|
|
1259
|
|
|
|
|
|
|
sub getTokenLevel { |
|
1260
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1261
|
|
|
|
|
|
|
|
|
1262
|
0
|
|
|
|
|
|
return($self->{'token_level'}); |
|
1263
|
|
|
|
|
|
|
} |
|
1264
|
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
sub getWordLevel { |
|
1266
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1267
|
|
|
|
|
|
|
|
|
1268
|
0
|
|
|
|
|
|
return($self->{'word_level'}); |
|
1269
|
|
|
|
|
|
|
} |
|
1270
|
|
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
|
sub getPhraseLevel { |
|
1272
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1273
|
|
|
|
|
|
|
|
|
1274
|
0
|
|
|
|
|
|
return($self->{'phrase_level'}); |
|
1275
|
|
|
|
|
|
|
} |
|
1276
|
|
|
|
|
|
|
|
|
1277
|
|
|
|
|
|
|
sub getEnumerationLevel { |
|
1278
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1279
|
|
|
|
|
|
|
|
|
1280
|
0
|
|
|
|
|
|
return($self->{'enumeration_level'}); |
|
1281
|
|
|
|
|
|
|
} |
|
1282
|
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
sub getSentenceLevel { |
|
1284
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1285
|
|
|
|
|
|
|
|
|
1286
|
0
|
|
|
|
|
|
return($self->{'sentence_level'}); |
|
1287
|
|
|
|
|
|
|
} |
|
1288
|
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
sub getSyntacticRelationLevel { |
|
1290
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1291
|
|
|
|
|
|
|
|
|
1292
|
0
|
|
|
|
|
|
return($self->{'syntactic_relation_level'}); |
|
1293
|
|
|
|
|
|
|
} |
|
1294
|
|
|
|
|
|
|
|
|
1295
|
|
|
|
|
|
|
sub getSemanticUnitLevel { |
|
1296
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1297
|
|
|
|
|
|
|
|
|
1298
|
0
|
|
|
|
|
|
return($self->{'semantic_unit_level'}); |
|
1299
|
|
|
|
|
|
|
} |
|
1300
|
|
|
|
|
|
|
|
|
1301
|
|
|
|
|
|
|
sub getDomainSpecificRelationLevel { |
|
1302
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1303
|
|
|
|
|
|
|
|
|
1304
|
0
|
|
|
|
|
|
return($self->{'domain_specific_relation_level'}); |
|
1305
|
|
|
|
|
|
|
} |
|
1306
|
|
|
|
|
|
|
|
|
1307
|
|
|
|
|
|
|
sub getAnaphoraRelationLevel { |
|
1308
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1309
|
|
|
|
|
|
|
|
|
1310
|
0
|
|
|
|
|
|
return($self->{'anaphora_relation_level'}); |
|
1311
|
|
|
|
|
|
|
} |
|
1312
|
|
|
|
|
|
|
|
|
1313
|
|
|
|
|
|
|
sub getLemmaLevel { |
|
1314
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1315
|
|
|
|
|
|
|
|
|
1316
|
0
|
|
|
|
|
|
return($self->{'lemma_level'}); |
|
1317
|
|
|
|
|
|
|
} |
|
1318
|
|
|
|
|
|
|
|
|
1319
|
|
|
|
|
|
|
sub getLogLevel { |
|
1320
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1321
|
|
|
|
|
|
|
|
|
1322
|
0
|
|
|
|
|
|
return($self->{'log_level'}); |
|
1323
|
|
|
|
|
|
|
} |
|
1324
|
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
sub getMorphosyntacticFeaturesLevel { |
|
1326
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1327
|
|
|
|
|
|
|
|
|
1328
|
0
|
|
|
|
|
|
return($self->{'morphosyntactic_features_level'}); |
|
1329
|
|
|
|
|
|
|
} |
|
1330
|
|
|
|
|
|
|
|
|
1331
|
|
|
|
|
|
|
sub getSemanticFeaturesLevel { |
|
1332
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1333
|
|
|
|
|
|
|
|
|
1334
|
0
|
|
|
|
|
|
return($self->{'semantic_features_level'}); |
|
1335
|
|
|
|
|
|
|
} |
|
1336
|
|
|
|
|
|
|
|
|
1337
|
|
|
|
|
|
|
sub getStemLevel { |
|
1338
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1339
|
|
|
|
|
|
|
|
|
1340
|
0
|
|
|
|
|
|
return($self->{'stem_level'}); |
|
1341
|
|
|
|
|
|
|
} |
|
1342
|
|
|
|
|
|
|
|
|
1343
|
|
|
|
|
|
|
sub addSection { |
|
1344
|
0
|
|
|
0
|
0
|
|
my ($self, $section, $parentSection) = @_; |
|
1345
|
|
|
|
|
|
|
|
|
1346
|
0
|
|
|
|
|
|
my $parentSection2; |
|
1347
|
|
|
|
|
|
|
|
|
1348
|
0
|
|
|
|
|
|
my $id = $self->getSectionLevel->addElement($section); |
|
1349
|
|
|
|
|
|
|
|
|
1350
|
0
|
0
|
|
|
|
|
if (defined $parentSection) { |
|
1351
|
0
|
0
|
|
|
|
|
if (ref($parentSection) eq "") { |
|
1352
|
0
|
0
|
|
|
|
|
if ($self->getSectionLevel->existsElement($parentSection)) { |
|
1353
|
0
|
|
|
|
|
|
$parentSection2 = $self->getSectionLevel->getElement($parentSection); |
|
1354
|
|
|
|
|
|
|
} |
|
1355
|
|
|
|
|
|
|
} else { |
|
1356
|
0
|
|
|
|
|
|
$parentSection2 = $parentSection; |
|
1357
|
|
|
|
|
|
|
} |
|
1358
|
0
|
0
|
|
|
|
|
if (defined $parentSection2) { |
|
1359
|
0
|
|
|
|
|
|
$section->parent_section($parentSection2); |
|
1360
|
0
|
|
|
|
|
|
push @{$parentSection2->child_sections}, $section; |
|
|
0
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
} |
|
1362
|
|
|
|
|
|
|
} |
|
1363
|
|
|
|
|
|
|
|
|
1364
|
0
|
0
|
|
|
|
|
warn "section $id added\n" unless $debug_devel_level != 1; |
|
1365
|
0
|
|
|
|
|
|
return($id); |
|
1366
|
|
|
|
|
|
|
} |
|
1367
|
|
|
|
|
|
|
|
|
1368
|
|
|
|
|
|
|
sub addToken { |
|
1369
|
0
|
|
|
0
|
0
|
|
my ($self, $token) = @_; |
|
1370
|
|
|
|
|
|
|
|
|
1371
|
0
|
|
|
|
|
|
my $id = $self->getTokenLevel->addElement($token); |
|
1372
|
0
|
0
|
|
|
|
|
warn "token $id added\n" unless $debug_devel_level != 1; |
|
1373
|
0
|
|
|
|
|
|
return($id); |
|
1374
|
|
|
|
|
|
|
} |
|
1375
|
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
sub addWord { |
|
1377
|
0
|
|
|
0
|
0
|
|
my ($self, $word) = @_; |
|
1378
|
|
|
|
|
|
|
|
|
1379
|
|
|
|
|
|
|
|
|
1380
|
0
|
|
|
|
|
|
my $id = $self->getWordLevel->addElement($word); |
|
1381
|
0
|
0
|
|
|
|
|
warn "word $id added\n" unless $debug_devel_level != 1; |
|
1382
|
0
|
|
|
|
|
|
return($id); |
|
1383
|
|
|
|
|
|
|
} |
|
1384
|
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
sub addSentence { |
|
1386
|
0
|
|
|
0
|
0
|
|
my ($self, $sentence) = @_; |
|
1387
|
|
|
|
|
|
|
|
|
1388
|
0
|
|
|
|
|
|
my $id = $self->getSentenceLevel->addElement($sentence); |
|
1389
|
0
|
0
|
|
|
|
|
warn "sentence $id added\n" unless $debug_devel_level != 1; |
|
1390
|
0
|
|
|
|
|
|
return($id); |
|
1391
|
|
|
|
|
|
|
} |
|
1392
|
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
|
|
1394
|
|
|
|
|
|
|
sub addAnaphoraRelation { |
|
1395
|
0
|
|
|
0
|
0
|
|
my ($self, $anaphorarelation) = @_; |
|
1396
|
|
|
|
|
|
|
|
|
1397
|
0
|
|
|
|
|
|
my $id = $self->getAnaphoraRelationLevel->addElement($anaphorarelation); |
|
1398
|
0
|
0
|
|
|
|
|
warn "Anaphora relation $id added\n" unless $debug_devel_level != 1; |
|
1399
|
0
|
|
|
|
|
|
return($id); |
|
1400
|
|
|
|
|
|
|
} |
|
1401
|
|
|
|
|
|
|
|
|
1402
|
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
|
|
1404
|
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
sub addDomainSpecificRelation { |
|
1406
|
0
|
|
|
0
|
0
|
|
my ($self, $domainspecificrelation) = @_; |
|
1407
|
|
|
|
|
|
|
|
|
1408
|
0
|
|
|
|
|
|
my $id = $self->getDomainSpecificRelationLevel->addElement($domainspecificrelation); |
|
1409
|
0
|
0
|
|
|
|
|
warn "Domain specific relation $id added\n" unless $debug_devel_level != 1; |
|
1410
|
0
|
|
|
|
|
|
return($id); |
|
1411
|
|
|
|
|
|
|
} |
|
1412
|
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
sub addLemma { |
|
1414
|
0
|
|
|
0
|
0
|
|
my ($self, $lemma) = @_; |
|
1415
|
|
|
|
|
|
|
|
|
1416
|
0
|
|
|
|
|
|
my $id = $self->getLemmaLevel->addElement($lemma); |
|
1417
|
0
|
0
|
|
|
|
|
warn "Lemma $id added\n" unless $debug_devel_level != 1; |
|
1418
|
0
|
|
|
|
|
|
return($id); |
|
1419
|
|
|
|
|
|
|
} |
|
1420
|
|
|
|
|
|
|
|
|
1421
|
|
|
|
|
|
|
|
|
1422
|
|
|
|
|
|
|
sub addMorphosyntacticFeatures { |
|
1423
|
0
|
|
|
0
|
0
|
|
my ($self, $morphosyntacticfeatures) = @_; |
|
1424
|
|
|
|
|
|
|
|
|
1425
|
0
|
|
|
|
|
|
my $id = $self->getMorphosyntacticFeaturesLevel->addElement($morphosyntacticfeatures); |
|
1426
|
0
|
0
|
|
|
|
|
warn "Morphosyntactic features $id added\n" unless $debug_devel_level != 1; |
|
1427
|
0
|
|
|
|
|
|
return($id); |
|
1428
|
|
|
|
|
|
|
} |
|
1429
|
|
|
|
|
|
|
|
|
1430
|
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
sub addPhrase { |
|
1432
|
0
|
|
|
0
|
0
|
|
my ($self, $phrase) = @_; |
|
1433
|
|
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
|
# warn "AddPhrase\n"; |
|
1435
|
0
|
|
|
|
|
|
my $id = $self->getPhraseLevel->addElement($phrase); |
|
1436
|
|
|
|
|
|
|
# warn "Phrase $id added\n"; # unless $debug_devel_level != 1; |
|
1437
|
0
|
|
|
|
|
|
return($id); |
|
1438
|
|
|
|
|
|
|
} |
|
1439
|
|
|
|
|
|
|
|
|
1440
|
|
|
|
|
|
|
sub addEnumeration { |
|
1441
|
0
|
|
|
0
|
0
|
|
my ($self, $enumeration) = @_; |
|
1442
|
|
|
|
|
|
|
|
|
1443
|
|
|
|
|
|
|
# warn "AddEnumeration\n"; |
|
1444
|
0
|
|
|
|
|
|
my $id = $self->getEnumerationLevel->addElement($enumeration); |
|
1445
|
|
|
|
|
|
|
# warn "Enumeration $id added\n"; # unless $debug_devel_level != 1; |
|
1446
|
0
|
|
|
|
|
|
return($id); |
|
1447
|
|
|
|
|
|
|
} |
|
1448
|
|
|
|
|
|
|
|
|
1449
|
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
sub addSemanticFeatures { |
|
1451
|
0
|
|
|
0
|
0
|
|
my ($self, $semanticfeatures) = @_; |
|
1452
|
|
|
|
|
|
|
|
|
1453
|
0
|
|
|
|
|
|
my $id = $self->getSemanticFeaturesLevel->addElement($semanticfeatures); |
|
1454
|
0
|
0
|
|
|
|
|
warn "Semantic features $id added\n" unless $debug_devel_level != 1; |
|
1455
|
0
|
|
|
|
|
|
return($id); |
|
1456
|
|
|
|
|
|
|
} |
|
1457
|
|
|
|
|
|
|
|
|
1458
|
|
|
|
|
|
|
sub delSemanticFeaturesFromTermId { |
|
1459
|
0
|
|
|
0
|
0
|
|
my ($self, $semanticUnit) = @_; |
|
1460
|
|
|
|
|
|
|
|
|
1461
|
0
|
|
|
|
|
|
my $id; |
|
1462
|
|
|
|
|
|
|
my $semanticFeatures ; |
|
1463
|
|
|
|
|
|
|
|
|
1464
|
0
|
|
|
|
|
|
my @tmp; |
|
1465
|
|
|
|
|
|
|
|
|
1466
|
0
|
|
|
|
|
|
my $i = 0; |
|
1467
|
|
|
|
|
|
|
# warn "#SemF: " . scalar(@{$self->getSemanticFeaturesLevel->getElementFromIndex("refid_semantic_unit", $semanticUnit->getId)}) . "\n"; |
|
1468
|
|
|
|
|
|
|
|
|
1469
|
0
|
|
|
|
|
|
foreach $semanticFeatures (@{$self->getSemanticFeaturesLevel->getElementFromIndex("refid_semantic_unit", $semanticUnit->getId)}) { |
|
|
0
|
|
|
|
|
|
|
|
1470
|
0
|
0
|
|
|
|
|
if (defined $semanticFeatures) { |
|
1471
|
|
|
|
|
|
|
# warn "=>" . $semanticFeatures->getId . " (" . $i++ . ")\n"; |
|
1472
|
0
|
|
|
|
|
|
$id = $self->getSemanticFeaturesLevel->delElement($semanticFeatures); |
|
1473
|
0
|
0
|
|
|
|
|
warn "semantic features $id deleted\n" unless $debug_devel_level != 1; |
|
1474
|
0
|
|
|
|
|
|
push @tmp, $id; |
|
1475
|
|
|
|
|
|
|
} else { |
|
1476
|
|
|
|
|
|
|
# warn "No semantic features\n"; |
|
1477
|
|
|
|
|
|
|
} |
|
1478
|
|
|
|
|
|
|
} |
|
1479
|
0
|
|
|
|
|
|
return(\@tmp); |
|
1480
|
|
|
|
|
|
|
} |
|
1481
|
|
|
|
|
|
|
|
|
1482
|
|
|
|
|
|
|
|
|
1483
|
|
|
|
|
|
|
|
|
1484
|
|
|
|
|
|
|
sub addStem { |
|
1485
|
0
|
|
|
0
|
0
|
|
my ($self, $stem) = @_; |
|
1486
|
|
|
|
|
|
|
|
|
1487
|
0
|
|
|
|
|
|
my $id = $self->getStemLevel->addElement($stem); |
|
1488
|
0
|
0
|
|
|
|
|
warn "stem $id added\n" unless $debug_devel_level != 1; |
|
1489
|
0
|
|
|
|
|
|
return($id); |
|
1490
|
|
|
|
|
|
|
} |
|
1491
|
|
|
|
|
|
|
|
|
1492
|
|
|
|
|
|
|
sub addSyntacticRelation { |
|
1493
|
0
|
|
|
0
|
0
|
|
my ($self, $syntacticrelation) = @_; |
|
1494
|
|
|
|
|
|
|
|
|
1495
|
0
|
|
|
|
|
|
my $id = $self->getSyntacticRelationLevel->addElement($syntacticrelation); |
|
1496
|
0
|
0
|
|
|
|
|
warn "Syntactic relation $id added\n" unless $debug_devel_level != 1; |
|
1497
|
0
|
|
|
|
|
|
return($id); |
|
1498
|
|
|
|
|
|
|
} |
|
1499
|
|
|
|
|
|
|
|
|
1500
|
|
|
|
|
|
|
sub addLogProcessing { |
|
1501
|
0
|
|
|
0
|
0
|
|
my ($self, $logprocessing) = @_; |
|
1502
|
|
|
|
|
|
|
|
|
1503
|
0
|
|
|
|
|
|
my $id = $self->getLogLevel->addElement($logprocessing); |
|
1504
|
0
|
0
|
|
|
|
|
warn "Log processing $id added\n" unless $debug_devel_level != 1; |
|
1505
|
|
|
|
|
|
|
} |
|
1506
|
|
|
|
|
|
|
|
|
1507
|
|
|
|
|
|
|
sub addSemanticUnit { |
|
1508
|
0
|
|
|
0
|
0
|
|
my ($self, $semanticUnit) = @_; |
|
1509
|
|
|
|
|
|
|
|
|
1510
|
0
|
|
|
|
|
|
my $id = $self->getSemanticUnitLevel->addElement($semanticUnit); |
|
1511
|
0
|
0
|
|
|
|
|
warn "semantic unit $id added\n" unless $debug_devel_level != 1; |
|
1512
|
0
|
|
|
|
|
|
return($id); |
|
1513
|
|
|
|
|
|
|
} |
|
1514
|
|
|
|
|
|
|
|
|
1515
|
|
|
|
|
|
|
sub delSemanticUnit { |
|
1516
|
0
|
|
|
0
|
0
|
|
my ($self, $semanticUnit) = @_; |
|
1517
|
|
|
|
|
|
|
|
|
1518
|
|
|
|
|
|
|
# warn "del : " . $semanticUnit->getId . "\n"; |
|
1519
|
0
|
|
|
|
|
|
$self->delSemanticFeaturesFromTermId($semanticUnit); |
|
1520
|
|
|
|
|
|
|
# warn "OK\n"; |
|
1521
|
0
|
|
|
|
|
|
my $id = $self->getSemanticUnitLevel->delElement($semanticUnit); |
|
1522
|
|
|
|
|
|
|
# warn "End\n"; |
|
1523
|
|
|
|
|
|
|
# if ($semanticUnit->reference_name eq "refid_phrase") { |
|
1524
|
|
|
|
|
|
|
# warn "remove " . $semanticUnit->reference . "\n"; |
|
1525
|
|
|
|
|
|
|
# $self->getSemanticUnitLevel->delElementToIndexes($semanticUnit->reference); |
|
1526
|
|
|
|
|
|
|
# } |
|
1527
|
|
|
|
|
|
|
|
|
1528
|
|
|
|
|
|
|
|
|
1529
|
0
|
0
|
|
|
|
|
warn "semantic unit $id deleted\n" unless $debug_devel_level != 1; |
|
1530
|
0
|
|
|
|
|
|
return($id); |
|
1531
|
|
|
|
|
|
|
} |
|
1532
|
|
|
|
|
|
|
|
|
1533
|
|
|
|
|
|
|
sub delEnumeration { |
|
1534
|
0
|
|
|
0
|
0
|
|
my ($self, $enumeration) = @_; |
|
1535
|
|
|
|
|
|
|
|
|
1536
|
0
|
|
|
|
|
|
my $id = $self->getEnumerationLevel->delElement($enumeration); |
|
1537
|
|
|
|
|
|
|
|
|
1538
|
|
|
|
|
|
|
# if ($semanticUnit->reference_name eq "refid_phrase") { |
|
1539
|
|
|
|
|
|
|
# warn "remove " . $semanticUnit->reference . "\n"; |
|
1540
|
|
|
|
|
|
|
# $self->getSemanticUnitLevel->delElementToIndexes($semanticUnit->reference); |
|
1541
|
|
|
|
|
|
|
# } |
|
1542
|
|
|
|
|
|
|
|
|
1543
|
|
|
|
|
|
|
|
|
1544
|
0
|
0
|
|
|
|
|
warn "semantic unit $id deleted\n" unless $debug_devel_level != 1; |
|
1545
|
0
|
|
|
|
|
|
return($id); |
|
1546
|
|
|
|
|
|
|
} |
|
1547
|
|
|
|
|
|
|
|
|
1548
|
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
sub XMLout { |
|
1550
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1551
|
0
|
|
|
|
|
|
my $level; |
|
1552
|
|
|
|
|
|
|
|
|
1553
|
|
|
|
|
|
|
my $str; |
|
1554
|
|
|
|
|
|
|
|
|
1555
|
0
|
|
|
|
|
|
$str = $self->getAcquisitionSection->toString; |
|
1556
|
0
|
|
|
|
|
|
$str .= "\n \n"; |
|
1557
|
0
|
|
|
|
|
|
foreach $level ($self->getLevels4Print) { |
|
1558
|
|
|
|
|
|
|
# warn "$level\n"; |
|
1559
|
0
|
|
|
|
|
|
$str .= $level->XMLout; |
|
1560
|
|
|
|
|
|
|
} |
|
1561
|
0
|
|
|
|
|
|
$str .= " \n"; |
|
1562
|
0
|
0
|
|
|
|
|
if (defined $self->getRelevanceSection) { |
|
1563
|
0
|
|
|
|
|
|
$self->getRelevanceSection; #->toString; |
|
1564
|
|
|
|
|
|
|
} |
|
1565
|
|
|
|
|
|
|
|
|
1566
|
0
|
|
|
|
|
|
return($str); |
|
1567
|
|
|
|
|
|
|
} |
|
1568
|
|
|
|
|
|
|
|
|
1569
|
|
|
|
|
|
|
sub getNamedEntitiesByType { |
|
1570
|
0
|
|
|
0
|
0
|
|
my ($self, $type) = @_; |
|
1571
|
|
|
|
|
|
|
|
|
1572
|
0
|
|
|
|
|
|
my $element; |
|
1573
|
|
|
|
|
|
|
my @tmp; |
|
1574
|
|
|
|
|
|
|
|
|
1575
|
0
|
|
|
|
|
|
foreach $element (@{$self->getSemanticUnitLevel->getElements}) { |
|
|
0
|
|
|
|
|
|
|
|
1576
|
0
|
0
|
0
|
|
|
|
if (($element->isNamedEntity) && ($element->NEtype eq $type)){ |
|
1577
|
0
|
|
|
|
|
|
push @tmp, $element; |
|
1578
|
|
|
|
|
|
|
} |
|
1579
|
|
|
|
|
|
|
} |
|
1580
|
0
|
|
|
|
|
|
return(\@tmp); |
|
1581
|
|
|
|
|
|
|
} |
|
1582
|
|
|
|
|
|
|
|
|
1583
|
|
|
|
|
|
|
sub getTermsByType { |
|
1584
|
0
|
|
|
0
|
0
|
|
my ($self, $type) = @_; |
|
1585
|
|
|
|
|
|
|
|
|
1586
|
0
|
|
|
|
|
|
my $element; |
|
1587
|
|
|
|
|
|
|
my @tmp; |
|
1588
|
0
|
|
|
|
|
|
my $semf; |
|
1589
|
|
|
|
|
|
|
|
|
1590
|
0
|
|
|
|
|
|
foreach $element (@{$self->getSemanticUnitLevel->getElements}) { |
|
|
0
|
|
|
|
|
|
|
|
1591
|
0
|
0
|
|
|
|
|
if ($element->isTerm) { |
|
1592
|
0
|
0
|
|
|
|
|
if ($self->getSemanticFeaturesLevel->existsElementFromIndex("refid_semantic_unit", $element->getId)) { |
|
1593
|
0
|
|
|
|
|
|
$semf = $self->getSemanticFeaturesLevel->getElementFromIndex("refid_semantic_unit", $element->getId)->[0]; |
|
1594
|
0
|
0
|
|
|
|
|
if ($semf->first_node_first_semantic_category eq $type) { |
|
1595
|
0
|
|
|
|
|
|
push @tmp, $element; |
|
1596
|
|
|
|
|
|
|
} |
|
1597
|
|
|
|
|
|
|
} |
|
1598
|
|
|
|
|
|
|
} |
|
1599
|
|
|
|
|
|
|
} |
|
1600
|
0
|
|
|
|
|
|
return(\@tmp); |
|
1601
|
|
|
|
|
|
|
} |
|
1602
|
|
|
|
|
|
|
|
|
1603
|
|
|
|
|
|
|
sub existsSectionLevel { |
|
1604
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1605
|
|
|
|
|
|
|
|
|
1606
|
0
|
|
|
|
|
|
return($self->{'section_level'}->getSize != 0); |
|
1607
|
|
|
|
|
|
|
} |
|
1608
|
|
|
|
|
|
|
|
|
1609
|
|
|
|
|
|
|
sub existsTokenLevel { |
|
1610
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1611
|
|
|
|
|
|
|
|
|
1612
|
0
|
|
|
|
|
|
return($self->{'token_level'}->getSize != 0); |
|
1613
|
|
|
|
|
|
|
} |
|
1614
|
|
|
|
|
|
|
|
|
1615
|
|
|
|
|
|
|
sub existsWordLevel { |
|
1616
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1617
|
|
|
|
|
|
|
|
|
1618
|
0
|
|
|
|
|
|
return($self->{'word_level'}->getSize != 0); |
|
1619
|
|
|
|
|
|
|
} |
|
1620
|
|
|
|
|
|
|
|
|
1621
|
|
|
|
|
|
|
sub existsPhraseLevel { |
|
1622
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1623
|
|
|
|
|
|
|
|
|
1624
|
0
|
|
|
|
|
|
return($self->{'phrase_level'}->getSize != 0); |
|
1625
|
|
|
|
|
|
|
} |
|
1626
|
|
|
|
|
|
|
|
|
1627
|
|
|
|
|
|
|
sub existsEnumerationLevel { |
|
1628
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1629
|
|
|
|
|
|
|
|
|
1630
|
0
|
|
|
|
|
|
return($self->{'enumeration_level'}->getSize != 0); |
|
1631
|
|
|
|
|
|
|
} |
|
1632
|
|
|
|
|
|
|
|
|
1633
|
|
|
|
|
|
|
sub existsSentenceLevel { |
|
1634
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1635
|
|
|
|
|
|
|
|
|
1636
|
0
|
|
|
|
|
|
return($self->{'sentence_level'}->getSize != 0); |
|
1637
|
|
|
|
|
|
|
} |
|
1638
|
|
|
|
|
|
|
|
|
1639
|
|
|
|
|
|
|
sub existsSyntacticRelationLevel { |
|
1640
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1641
|
|
|
|
|
|
|
|
|
1642
|
0
|
|
|
|
|
|
return($self->{'syntactic_relation_level'}->getSize != 0); |
|
1643
|
|
|
|
|
|
|
} |
|
1644
|
|
|
|
|
|
|
|
|
1645
|
|
|
|
|
|
|
sub existsSemanticUnitLevel { |
|
1646
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1647
|
|
|
|
|
|
|
|
|
1648
|
0
|
|
|
|
|
|
return($self->{'semantic_unit_level'}->getSize != 0); |
|
1649
|
|
|
|
|
|
|
} |
|
1650
|
|
|
|
|
|
|
|
|
1651
|
|
|
|
|
|
|
sub existsDomainSpecificRelationLevel { |
|
1652
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1653
|
|
|
|
|
|
|
|
|
1654
|
0
|
|
|
|
|
|
return($self->{'domain_specific_relation_level'}->getSize != 0); |
|
1655
|
|
|
|
|
|
|
} |
|
1656
|
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
sub existsAnaphoraRelationLevel { |
|
1658
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1659
|
|
|
|
|
|
|
|
|
1660
|
0
|
|
|
|
|
|
return($self->{'anaphora_relation_level'}->getSize != 0); |
|
1661
|
|
|
|
|
|
|
} |
|
1662
|
|
|
|
|
|
|
|
|
1663
|
|
|
|
|
|
|
sub existsLemmaLevel { |
|
1664
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1665
|
|
|
|
|
|
|
|
|
1666
|
0
|
|
|
|
|
|
return($self->{'lemma_level'}->getSize != 0); |
|
1667
|
|
|
|
|
|
|
} |
|
1668
|
|
|
|
|
|
|
|
|
1669
|
|
|
|
|
|
|
sub existsLogLevel { |
|
1670
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1671
|
|
|
|
|
|
|
|
|
1672
|
0
|
|
|
|
|
|
return($self->{'log_level'}->getSize != 0); |
|
1673
|
|
|
|
|
|
|
} |
|
1674
|
|
|
|
|
|
|
|
|
1675
|
|
|
|
|
|
|
sub existsMorphosyntacticFeaturesLevel { |
|
1676
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1677
|
|
|
|
|
|
|
|
|
1678
|
0
|
|
|
|
|
|
return($self->{'morphosyntactic_features_level'}->getSize != 0); |
|
1679
|
|
|
|
|
|
|
} |
|
1680
|
|
|
|
|
|
|
|
|
1681
|
|
|
|
|
|
|
sub existsSemanticFeaturesLevel { |
|
1682
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1683
|
|
|
|
|
|
|
|
|
1684
|
0
|
|
|
|
|
|
return($self->{'semantic_features_level'}->getSize != 0); |
|
1685
|
|
|
|
|
|
|
} |
|
1686
|
|
|
|
|
|
|
|
|
1687
|
|
|
|
|
|
|
sub existsStemLevel { |
|
1688
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
1689
|
|
|
|
|
|
|
|
|
1690
|
0
|
|
|
|
|
|
return($self->{'stem_level'}->getSize != 0); |
|
1691
|
|
|
|
|
|
|
} |
|
1692
|
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
|
|
1694
|
|
|
|
|
|
|
1; |
|
1695
|
|
|
|
|
|
|
|
|
1696
|
|
|
|
|
|
|
__END__ |