| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Treex::Core::BundleZone; |
|
2
|
|
|
|
|
|
|
$Treex::Core::BundleZone::VERSION = '2.20210102'; |
|
3
|
24
|
|
|
24
|
|
201
|
use Moose; |
|
|
24
|
|
|
|
|
69
|
|
|
|
24
|
|
|
|
|
211
|
|
|
4
|
24
|
|
|
24
|
|
173078
|
use Treex::Core::Common; |
|
|
24
|
|
|
|
|
67
|
|
|
|
24
|
|
|
|
|
274
|
|
|
5
|
24
|
|
|
24
|
|
143490
|
use MooseX::NonMoose; |
|
|
24
|
|
|
|
|
73
|
|
|
|
24
|
|
|
|
|
245
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
24
|
|
|
24
|
|
148311
|
use Treex::Core::Node::A; |
|
|
24
|
|
|
|
|
69
|
|
|
|
24
|
|
|
|
|
774
|
|
|
8
|
24
|
|
|
24
|
|
152
|
use Treex::Core::Node::T; |
|
|
24
|
|
|
|
|
62
|
|
|
|
24
|
|
|
|
|
759
|
|
|
9
|
24
|
|
|
24
|
|
144
|
use Treex::Core::Node::N; |
|
|
24
|
|
|
|
|
59
|
|
|
|
24
|
|
|
|
|
691
|
|
|
10
|
24
|
|
|
24
|
|
156
|
use Treex::Core::Node::P; |
|
|
24
|
|
|
|
|
60
|
|
|
|
24
|
|
|
|
|
41480
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
extends 'Treex::Core::Zone'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _set_bundle { |
|
15
|
48
|
|
|
48
|
|
117
|
my $self = shift; |
|
16
|
48
|
|
|
|
|
315
|
my ($bundle) = pos_validated_list( |
|
17
|
|
|
|
|
|
|
\@_, |
|
18
|
|
|
|
|
|
|
{ isa => 'Treex::Core::Bundle' }, |
|
19
|
|
|
|
|
|
|
); |
|
20
|
48
|
|
|
|
|
341
|
$self->set_attr( '_bundle', $bundle ); |
|
21
|
48
|
|
|
|
|
223
|
weaken $self->{'_bundle'}; |
|
22
|
48
|
|
|
|
|
111
|
return; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub get_bundle { |
|
26
|
1281
|
|
|
1281
|
1
|
5018
|
my $self = shift; |
|
27
|
1281
|
|
|
|
|
4450
|
return $self->get_attr('_bundle'); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_document { |
|
31
|
42
|
|
|
42
|
1
|
73
|
my $self = shift; |
|
32
|
42
|
|
|
|
|
106
|
return $self->get_bundle->get_document; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub create_atree { |
|
36
|
9
|
|
|
9
|
1
|
76
|
my ($self,$params_rf) = @_; |
|
37
|
9
|
|
|
|
|
48
|
return $self->create_tree('a',$params_rf); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub create_ttree { |
|
41
|
10
|
|
|
10
|
1
|
1559
|
my ($self,$params_rf) = @_; |
|
42
|
10
|
|
|
|
|
52
|
return $self->create_tree('t',$params_rf); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub create_ntree { |
|
46
|
4
|
|
|
4
|
1
|
1491
|
my ($self,$params_rf) = @_; |
|
47
|
4
|
|
|
|
|
18
|
return $self->create_tree('n',$params_rf); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub create_ptree { |
|
51
|
6
|
|
|
6
|
1
|
1527
|
my ($self,$params_rf) = @_; |
|
52
|
6
|
|
|
|
|
29
|
return $self->create_tree('p',$params_rf); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub create_tree { |
|
56
|
78
|
|
|
78
|
1
|
4685
|
my $self = shift; |
|
57
|
78
|
|
|
|
|
450
|
my ($layer,$params_rf) = pos_validated_list( |
|
58
|
|
|
|
|
|
|
\@_, |
|
59
|
|
|
|
|
|
|
{ isa => 'Treex::Type::Layer' }, |
|
60
|
|
|
|
|
|
|
{ isa => 'Ref' }, |
|
61
|
|
|
|
|
|
|
); |
|
62
|
78
|
|
|
|
|
259
|
$layer = lc $layer; |
|
63
|
|
|
|
|
|
|
|
|
64
|
78
|
100
|
|
|
|
262
|
if ($self->has_tree($layer)) { |
|
65
|
12
|
50
|
33
|
|
|
67
|
if (defined $params_rf and $params_rf->{overwrite}) { |
|
66
|
12
|
|
|
|
|
39
|
$self->remove_tree($layer); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
else { |
|
69
|
0
|
|
|
|
|
0
|
log_fatal("Zone already contains tree at $layer layer"); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#my $class = "Treex::Core::Node::" . uc($layer); |
|
74
|
|
|
|
|
|
|
#my $tree_root = eval { $class->new( { _called_from_core_ => 1 } ) } or log_fatal $!; #layer subclasses not available yet |
|
75
|
78
|
|
|
|
|
242
|
my $opts = { _called_from_core_ => 1 }; |
|
76
|
78
|
50
|
|
|
|
3256
|
my $tree_root = $layer eq 'a' ? Treex::Core::Node::A->new($opts) |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
: $layer eq 't' ? Treex::Core::Node::T->new($opts) |
|
78
|
|
|
|
|
|
|
: $layer eq 'n' ? Treex::Core::Node::N->new($opts) |
|
79
|
|
|
|
|
|
|
: $layer eq 'p' ? Treex::Core::Node::P->new($opts) |
|
80
|
|
|
|
|
|
|
: log_fatal "Cannot create tree for unknown layer $layer"; |
|
81
|
|
|
|
|
|
|
|
|
82
|
78
|
|
|
|
|
844
|
my $bundle = $self->get_bundle; |
|
83
|
78
|
|
|
|
|
3030
|
$tree_root->_set_zone($self); |
|
84
|
|
|
|
|
|
|
|
|
85
|
78
|
|
|
|
|
277
|
my $new_tree_name = $layer . "_tree"; |
|
86
|
78
|
|
|
|
|
249
|
$self->{trees}->{$new_tree_name} = $tree_root; |
|
87
|
|
|
|
|
|
|
|
|
88
|
78
|
|
|
|
|
354
|
my $new_id = "$new_tree_name-" . $self->get_label . "-" . $bundle->get_id . "-root"; |
|
89
|
78
|
|
|
|
|
10875
|
$tree_root->set_id($new_id); |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# pml-typing |
|
92
|
|
|
|
|
|
|
#$tree_root->set_type_by_name( $self->get_document->metaData('schema'), lc($layer) . '-root.type' ); |
|
93
|
|
|
|
|
|
|
# $tree_root->set_type_by_name( $self->get_document->metaData('schema'), $tree_root->get_pml_type_name() ); |
|
94
|
|
|
|
|
|
|
|
|
95
|
78
|
|
|
|
|
428
|
$tree_root->fix_pml_type(); |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# vyresit usporadavaci atribut! |
|
98
|
|
|
|
|
|
|
# TODO: if $tree_root->does('Treex::Core::Role::OrderedTree') |
|
99
|
78
|
|
|
|
|
425
|
my $ordering_attribute = $tree_root->get_ordering_member_name; |
|
100
|
78
|
100
|
|
|
|
8884
|
if ( defined $ordering_attribute ) { |
|
101
|
52
|
|
|
|
|
284
|
$tree_root->set_attr( $ordering_attribute, 0 ); |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
78
|
|
|
|
|
526
|
return $tree_root; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub remove_tree { |
|
108
|
42
|
|
|
42
|
1
|
8313
|
my $self = shift; |
|
109
|
42
|
|
|
|
|
211
|
my ($layer) = pos_validated_list( |
|
110
|
|
|
|
|
|
|
\@_, |
|
111
|
|
|
|
|
|
|
{ isa => 'Treex::Type::Layer' }, |
|
112
|
|
|
|
|
|
|
); |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# remove all nodes ($tree_root->remove does not work, in order to not be used by users) |
|
115
|
42
|
|
|
|
|
151
|
my $tree_root = $self->get_tree($layer); |
|
116
|
42
|
|
|
|
|
192
|
foreach my $child ( $tree_root->get_children() ) { |
|
117
|
13
|
|
|
|
|
51
|
$child->remove(); |
|
118
|
|
|
|
|
|
|
} |
|
119
|
42
|
50
|
|
|
|
1389
|
if ( $tree_root->id ) { |
|
120
|
42
|
|
|
|
|
142
|
$self->get_document->index_node_by_id( $tree_root->id, undef ); |
|
121
|
|
|
|
|
|
|
} |
|
122
|
42
|
|
|
|
|
177
|
delete $self->{trees}{ lc($layer) . '_tree' }; |
|
123
|
42
|
|
|
|
|
171
|
return; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub get_tree { |
|
127
|
108
|
|
|
108
|
1
|
294390
|
my $self = shift; |
|
128
|
108
|
|
|
|
|
462
|
my ($layer) = pos_validated_list( |
|
129
|
|
|
|
|
|
|
\@_, |
|
130
|
|
|
|
|
|
|
{ isa => 'Treex::Type::Layer' }, |
|
131
|
|
|
|
|
|
|
); |
|
132
|
|
|
|
|
|
|
|
|
133
|
108
|
|
|
|
|
359
|
my $tree_name = lc($layer) . "_tree"; |
|
134
|
108
|
|
|
|
|
242
|
my $tree = $self->{trees}->{$tree_name}; |
|
135
|
|
|
|
|
|
|
|
|
136
|
108
|
50
|
|
|
|
283
|
if ( not defined $tree ) { |
|
137
|
0
|
|
|
|
|
0
|
log_fatal( "No $tree_name available in bundle ".$self->get_bundle->get_attr('id')." in zone " . $self->get_label() ); |
|
138
|
|
|
|
|
|
|
} |
|
139
|
108
|
|
|
|
|
538
|
return $tree; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub get_atree { |
|
143
|
9
|
|
|
9
|
1
|
65
|
my $self = shift; |
|
144
|
9
|
|
|
|
|
38
|
return $self->get_tree('a'); |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub get_ttree { |
|
148
|
9
|
|
|
9
|
1
|
54
|
my $self = shift; |
|
149
|
9
|
|
|
|
|
34
|
return $self->get_tree('t'); |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub get_ntree { |
|
153
|
7
|
|
|
7
|
1
|
50
|
my $self = shift; |
|
154
|
7
|
|
|
|
|
24
|
return $self->get_tree('n'); |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub get_ptree { |
|
158
|
6
|
|
|
6
|
1
|
75
|
my $self = shift; |
|
159
|
6
|
|
|
|
|
22
|
return $self->get_tree('p'); |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub has_tree { |
|
163
|
130
|
|
|
130
|
1
|
5409
|
my $self = shift; |
|
164
|
130
|
|
|
|
|
540
|
my ($layer) = pos_validated_list( |
|
165
|
|
|
|
|
|
|
\@_, |
|
166
|
|
|
|
|
|
|
{ isa => 'Treex::Type::Layer' }, |
|
167
|
|
|
|
|
|
|
); |
|
168
|
130
|
|
|
|
|
430
|
my $tree_name = lc($layer) . "_tree"; |
|
169
|
130
|
|
|
|
|
1388
|
return defined $self->{trees}->{$tree_name}; |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub has_atree { |
|
173
|
3
|
|
|
3
|
1
|
28
|
my $self = shift; |
|
174
|
3
|
|
|
|
|
14
|
return $self->has_tree('a'); |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub has_ttree { |
|
178
|
3
|
|
|
3
|
1
|
28
|
my $self = shift; |
|
179
|
3
|
|
|
|
|
13
|
return $self->has_tree('t'); |
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub has_ntree { |
|
183
|
3
|
|
|
3
|
1
|
21
|
my $self = shift; |
|
184
|
3
|
|
|
|
|
12
|
return $self->has_tree('n'); |
|
185
|
|
|
|
|
|
|
} |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub has_ptree { |
|
188
|
3
|
|
|
3
|
1
|
34
|
my $self = shift; |
|
189
|
3
|
|
|
|
|
13
|
return $self->has_tree('p'); |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub get_all_trees { |
|
193
|
459
|
|
|
459
|
1
|
727
|
my $self = shift; |
|
194
|
|
|
|
|
|
|
|
|
195
|
1836
|
|
|
|
|
3595
|
return grep {defined} |
|
196
|
459
|
|
|
|
|
739
|
map { $self->{trees}->{ $_ . "_tree" }; } qw(a t n p); |
|
|
1836
|
|
|
|
|
3452
|
|
|
197
|
|
|
|
|
|
|
} |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub sentence { |
|
200
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
201
|
0
|
|
|
|
|
|
return $self->get_attr('sentence'); |
|
202
|
|
|
|
|
|
|
} |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub set_sentence { |
|
205
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
206
|
0
|
|
|
|
|
|
my ($text) = pos_validated_list( |
|
207
|
|
|
|
|
|
|
\@_, |
|
208
|
|
|
|
|
|
|
{ isa => 'Str' }, |
|
209
|
|
|
|
|
|
|
); |
|
210
|
0
|
|
|
|
|
|
return $self->set_attr( 'sentence', $text ); |
|
211
|
|
|
|
|
|
|
} |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub copy { |
|
214
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
215
|
0
|
|
|
|
|
|
my $selector1 = shift; |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
# Get the bundle the zone is in. |
|
218
|
0
|
|
|
|
|
|
my $bundle = $self->get_bundle(); |
|
219
|
0
|
|
|
|
|
|
my $zone1 = $bundle->get_or_create_zone( $self->language(), $selector1 ); |
|
220
|
|
|
|
|
|
|
### TO DO: copy other trees, too (currently only copies a-tree and p-tree) |
|
221
|
0
|
0
|
|
|
|
|
if($self->has_atree()) |
|
222
|
|
|
|
|
|
|
{ |
|
223
|
0
|
|
|
|
|
|
my $aroot0 = $self->get_atree(); |
|
224
|
0
|
|
|
|
|
|
my $aroot1 = $zone1->create_atree(); |
|
225
|
0
|
|
|
|
|
|
$aroot0->copy_atree($aroot1); |
|
226
|
|
|
|
|
|
|
} |
|
227
|
0
|
0
|
|
|
|
|
if($self->has_ptree()) |
|
228
|
|
|
|
|
|
|
{ |
|
229
|
0
|
|
|
|
|
|
my $proot0 = $self->get_ptree(); |
|
230
|
0
|
|
|
|
|
|
my $proot1 = $zone1->create_ptree(); |
|
231
|
0
|
|
|
|
|
|
$proot0->copy_ptree($proot1); |
|
232
|
|
|
|
|
|
|
} |
|
233
|
0
|
|
|
|
|
|
return $zone1; |
|
234
|
|
|
|
|
|
|
} |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
1; |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
__END__ |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=for Pod::Coverage set_sentence |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=encoding utf-8 |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head1 NAME |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Treex::Core::BundleZone - contains a sentence and its linguistic representations |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head1 VERSION |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
version 2.20210102 |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
use Treex::Core; |
|
255
|
|
|
|
|
|
|
my $doc = Treex::Core->new; |
|
256
|
|
|
|
|
|
|
my $bundle = $doc->create_bundle(); |
|
257
|
|
|
|
|
|
|
my $zone = $bundle->create_zone('en','reference'); |
|
258
|
|
|
|
|
|
|
$zone->set_sentence('John loves Mary.'); |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
Document zones allow Treex documents to contain more texts, |
|
264
|
|
|
|
|
|
|
typically parallel texts (translations), or corresponding |
|
265
|
|
|
|
|
|
|
texts from different sources (text to be translated, reference |
|
266
|
|
|
|
|
|
|
translation, test translation). |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
C<Treex::Core::BundleZone> instances have the following attributes: |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=over 4 |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=item language |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=item selector |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=item sentence |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=back |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
The attributes can be accessed using semi-affordance accessors: getters have |
|
283
|
|
|
|
|
|
|
the same names as attributes, while setters start with C<set_>. For example, |
|
284
|
|
|
|
|
|
|
the attribute C<sentence> has a getter C<sentence()> and a setter |
|
285
|
|
|
|
|
|
|
C<set_sentence($sentence)> |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=head1 METHODS |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=head2 Construction |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
C<Treex::Core::BundleZone> instances should not be created by the constructor, |
|
293
|
|
|
|
|
|
|
but should be created exclusively by calling one of the following methods |
|
294
|
|
|
|
|
|
|
of the embedding L<Treex::Core::Bundle> instance: |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=over 4 |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=item create_zone |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=item get_or_create_zone |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=back |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=head2 Access to trees |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
There are four types of linguistic trees distinguished in Treex, each of them represented |
|
308
|
|
|
|
|
|
|
by one letter: I<a> - analytical treex, I<t> - tectogrammatical trees, I<p> - phrase-structure trees, |
|
309
|
|
|
|
|
|
|
I<n> - named entity trees. You can create trees by following methods: |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=over 4 |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=item $zone->create_tree($layer); |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=item $zone->create_atree(); |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=item $zone->create_ttree(); |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=item $zone->create_ptree(); |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=item $zone->create_ntree(); |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=back |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
You can access trees by |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=over 4 |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=item $zone->get_tree($layer); |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=item $zone->get_atree(); |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=item $zone->get_ttree(); |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=item $zone->get_ptree(); |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=item $zone->get_ntree(); |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=item $zone->get_all_trees(); |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
=back |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
Presence of a tree of a certain type can be detected by |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=over 4 |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=item $zone->has_tree($layer); |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=item $zone->has_atree(); |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=item $zone->has_ttree(); |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=item $zone->has_ptree(); |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=item $zone->has_ntree(); |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=back |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
You can remove trees by |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
=over 4 |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
=item $zone->remove_tree($layer); |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
=back |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=head2 Access to embedding objects |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=over 4 |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=item $bundle = $zone->get_bundle(); |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
returns the L<Treex::Core::Bundle> instance which the zone belongs to |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=item $doc = $zone->get_document(); |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
returns the L<Treex::Core::Document> instance which the zone belongs to |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=back |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
=head2 Other |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
=over 4 |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
=item $zone1 = $zone0->copy($selector1); |
|
391
|
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
creates a copy of the zone (currently copies only the a-tree) under the same language and a new selector |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
=back |
|
395
|
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
=head1 AUTHOR |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
Zdeněk Žabokrtský <zabokrtsky@ufal.mff.cuni.cz> |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
Martin Popel <popel@ufal.mff.cuni.cz> |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |