| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Treex::PML::Backend::CSTS::Fs2csts; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
14
|
use vars qw($VERSION); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
110
|
|
|
4
|
|
|
|
|
|
|
BEGIN { |
|
5
|
2
|
|
|
2
|
|
35
|
$VERSION='2.24'; # version template |
|
6
|
|
|
|
|
|
|
} |
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
13
|
use Treex::PML; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
179
|
|
|
9
|
2
|
|
|
2
|
|
12
|
no warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
3874
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $export_dependency=1; |
|
12
|
|
|
|
|
|
|
our $compatibility_mode=0; |
|
13
|
|
|
|
|
|
|
our $preserve_err1=0; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $gov = undef; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our @extra_attributes=(); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our %TRt = ( |
|
20
|
|
|
|
|
|
|
gender_ANIM => 'M', |
|
21
|
|
|
|
|
|
|
gender_INAN => 'I', |
|
22
|
|
|
|
|
|
|
gender_FEM => 'F', |
|
23
|
|
|
|
|
|
|
gender_NEUT => 'N', |
|
24
|
|
|
|
|
|
|
gender_NA => '-', |
|
25
|
|
|
|
|
|
|
number_SG => 'S', |
|
26
|
|
|
|
|
|
|
number_PL => 'P', |
|
27
|
|
|
|
|
|
|
number_NA => '-', |
|
28
|
|
|
|
|
|
|
degcmp_POS => '1', |
|
29
|
|
|
|
|
|
|
degcmp_COMP => '2', |
|
30
|
|
|
|
|
|
|
degcmp_SUP => '3', |
|
31
|
|
|
|
|
|
|
degcmp_NA => '-', |
|
32
|
|
|
|
|
|
|
tense_SIM => 'S', |
|
33
|
|
|
|
|
|
|
tense_POST => 'P', |
|
34
|
|
|
|
|
|
|
tense_ANT => 'A', |
|
35
|
|
|
|
|
|
|
tense_NA => '-', |
|
36
|
|
|
|
|
|
|
aspect_PROC => 'P', |
|
37
|
|
|
|
|
|
|
aspect_CPL => 'C', |
|
38
|
|
|
|
|
|
|
aspect_RES => 'R', |
|
39
|
|
|
|
|
|
|
aspect_NA => '-', |
|
40
|
|
|
|
|
|
|
iterativeness_IT1 => '1', |
|
41
|
|
|
|
|
|
|
iterativeness_IT0 => '0', |
|
42
|
|
|
|
|
|
|
iterativeness_NA => '-', |
|
43
|
|
|
|
|
|
|
verbmod_IND => 'I', |
|
44
|
|
|
|
|
|
|
verbmod_IMP => 'M', |
|
45
|
|
|
|
|
|
|
verbmod_CDN => 'C', |
|
46
|
|
|
|
|
|
|
verbmod_NA => '-', |
|
47
|
|
|
|
|
|
|
deontmod_DECL => 'D', |
|
48
|
|
|
|
|
|
|
deontmod_DEB => 'B', |
|
49
|
|
|
|
|
|
|
deontmod_HRT => 'H', |
|
50
|
|
|
|
|
|
|
deontmod_VOL => 'V', |
|
51
|
|
|
|
|
|
|
deontmod_POSS => 'S', |
|
52
|
|
|
|
|
|
|
deontmod_PERM => 'P', |
|
53
|
|
|
|
|
|
|
deontmod_FAC => 'F', |
|
54
|
|
|
|
|
|
|
deontmod_NA => '-', |
|
55
|
|
|
|
|
|
|
sentmod_ENUNC => '.', |
|
56
|
|
|
|
|
|
|
sentmod_EXCL => '!', |
|
57
|
|
|
|
|
|
|
sentmod_DESID => 'D', |
|
58
|
|
|
|
|
|
|
sentmod_IMPER => 'M', |
|
59
|
|
|
|
|
|
|
sentmod_INTER => '?', |
|
60
|
|
|
|
|
|
|
sentmod_NA => '-', |
|
61
|
|
|
|
|
|
|
); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub setupSpec { |
|
64
|
0
|
|
|
0
|
0
|
|
$gov = $_[0]; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub make_TRt { |
|
68
|
0
|
|
|
0
|
0
|
|
my ($node,$machine)=@_; |
|
69
|
0
|
|
|
|
|
|
my $result=""; |
|
70
|
0
|
|
|
|
|
|
foreach (qw(gender degcmp number tense aspect iterativeness verbmod deontmod sentmod)) { |
|
71
|
0
|
0
|
|
|
|
|
if (exists($TRt{$_."_".$node->{$_}})) { |
|
72
|
0
|
|
|
|
|
|
$result.=$TRt{$_."_".$node->{$_}}; |
|
73
|
|
|
|
|
|
|
} else { |
|
74
|
0
|
|
|
|
|
|
$result.="X"; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
} |
|
77
|
0
|
|
|
|
|
|
return $result; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub make_gap { |
|
81
|
0
|
|
|
0
|
0
|
|
my ($gap)=@_; |
|
82
|
0
|
|
|
|
|
|
$gap=~s/(.)\$1\n\
|
|
83
|
0
|
0
|
|
|
|
|
if ($gap ne "") { |
|
84
|
0
|
|
|
|
|
|
$gap.="\n"; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
0
|
|
|
|
|
|
return $gap; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub print_split_attr { |
|
90
|
0
|
|
|
0
|
0
|
|
my ($fileref,$value,$tag)=@_; |
|
91
|
0
|
0
|
|
|
|
|
return if $value eq ""; |
|
92
|
0
|
|
|
|
|
|
foreach (split(/\|/,$value)) { |
|
93
|
0
|
|
|
|
|
|
print $fileref "<$tag>",$_; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub print_split_attr_with_num_attr { |
|
98
|
0
|
|
|
0
|
0
|
|
my ($fileref,$node,$attr,$num,$tag,$at)=@_; |
|
99
|
0
|
0
|
|
|
|
|
return if $node->{$attr} eq ""; |
|
100
|
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my @t=split(/\|/,translate_to_entities($node->{$attr})); |
|
102
|
0
|
|
|
|
|
|
my @tw=split(/\|/,$node->{$num}); |
|
103
|
0
|
|
|
|
|
|
for (my $i=0;$i<=$#t;$i++) { |
|
104
|
0
|
0
|
|
|
|
|
if ($tw[$i]=~/(\d+)/) { |
|
105
|
0
|
|
|
|
|
|
print $fileref "<$tag $at=$1>",$t[$i]; |
|
106
|
|
|
|
|
|
|
} else { |
|
107
|
0
|
|
|
|
|
|
print $fileref "<$tag>",$t[$i]; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub translate_to_entities { |
|
113
|
0
|
|
|
0
|
0
|
|
my ($t)=@_; |
|
114
|
0
|
|
|
|
|
|
$t=~s/\</g; |
|
115
|
0
|
|
|
|
|
|
$t=~s/\>/>/g; |
|
116
|
0
|
0
|
|
|
|
|
if (length($t)==1) { |
|
117
|
0
|
|
|
|
|
|
$t=~s/\[/[/g; |
|
118
|
0
|
|
|
|
|
|
$t=~s/\]/]/g; |
|
119
|
0
|
|
|
|
|
|
$t=~s/\\\|/|/g; |
|
120
|
0
|
|
|
|
|
|
$t=~s/\$/$/g; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
0
|
|
|
|
|
|
return $t; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub write { |
|
126
|
0
|
|
|
0
|
0
|
|
my ($fileref,$fsfile) = @_; |
|
127
|
0
|
0
|
|
|
|
|
return unless ref($fsfile); |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
my @nodes; |
|
130
|
|
|
|
|
|
|
my $node; |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# print the file information from the root node |
|
133
|
0
|
|
|
|
|
|
my $root = $fsfile->treeList->[0]; |
|
134
|
0
|
0
|
|
|
|
|
if ($root) { |
|
135
|
0
|
0
|
|
|
|
|
my $lang = $root->{cstslang} ? $root->{cstslang} : "cs"; |
|
136
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
137
|
0
|
0
|
0
|
|
|
|
if ($root->{cstssource} ne "" or $root->{cstsmarkup} ne "") { |
|
138
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
139
|
0
|
|
|
|
|
|
print $fileref ""; |
|
140
|
0
|
|
|
|
|
|
print $fileref $root->{cstssource}; |
|
141
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
142
|
0
|
|
|
|
|
|
print $fileref ""; |
|
143
|
0
|
|
|
|
|
|
my $markup=$root->{cstsmarkup}; |
|
144
|
0
|
|
|
|
|
|
$markup=~s/(.)\\\
|
|
145
|
0
|
|
|
|
|
|
$markup=~s/\\n\
|
|
146
|
0
|
|
|
|
|
|
print $fileref $markup; |
|
147
|
0
|
|
|
|
|
|
print $fileref "\n\n"; |
|
148
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
} |
|
151
|
0
|
|
|
|
|
|
my $treeNo=0; |
|
152
|
0
|
|
|
|
|
|
foreach $root ($fsfile->trees) { |
|
153
|
0
|
|
|
|
|
|
$treeNo++; |
|
154
|
0
|
|
|
|
|
|
@nodes=(); |
|
155
|
0
|
|
|
|
|
|
$node=$root->following; |
|
156
|
0
|
|
|
|
|
|
while ($node) { |
|
157
|
0
|
|
|
|
|
|
push @nodes,$node; |
|
158
|
0
|
|
|
|
|
|
$node=$node->following; |
|
159
|
|
|
|
|
|
|
} |
|
160
|
0
|
|
|
|
|
|
my $sentord=$fsfile->FS->sentord; |
|
161
|
0
|
|
|
|
|
|
@nodes = sort { $a->{$sentord} <=> $b->{$sentord} } @nodes; |
|
|
0
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
# print sentence information from root node |
|
163
|
0
|
0
|
|
|
|
|
if (ref($root)) { |
|
164
|
0
|
0
|
0
|
|
|
|
if ($treeNo==1 or $root->{doc}.$root->{docid} ne "") { |
|
165
|
0
|
0
|
|
|
|
|
if ($treeNo>1) { |
|
166
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
167
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
168
|
|
|
|
|
|
|
} |
|
169
|
|
|
|
|
|
|
print $fileref "{doc},"\" id=\"", |
|
170
|
0
|
0
|
|
|
|
|
($root->{docid}=~/^\d+$/ ? $root->{docid} : "0"),"\">\n"; |
|
171
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
172
|
0
|
0
|
|
|
|
|
if ($root->{docmarkup} =~ /\
|
|
173
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
174
|
0
|
|
|
|
|
|
print $fileref $root->{docmarkup}; |
|
175
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
176
|
|
|
|
|
|
|
} |
|
177
|
0
|
|
|
|
|
|
my ($genre,$id,$authname)=("mix",$root->{docid},"y"); |
|
178
|
|
|
|
|
|
|
my ($mod,$txtype,$med,$temp,$opus)= |
|
179
|
0
|
|
|
|
|
|
$root->{doc}=~m!([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)!; |
|
180
|
0
|
|
|
|
|
|
print $fileref ""; |
|
181
|
0
|
0
|
|
|
|
|
print $fileref $root->{docprolog} =~ /\([^\<*]*)/ ? |
|
182
|
|
|
|
|
|
|
$1 : $mod,"\n"; |
|
183
|
0
|
|
|
|
|
|
print $fileref ""; |
|
184
|
0
|
0
|
|
|
|
|
print $fileref $root->{docprolog} =~ /\([^\<*]*)/ ? |
|
185
|
|
|
|
|
|
|
$1 : $txtype,"\n"; |
|
186
|
0
|
|
|
|
|
|
print $fileref ""; |
|
187
|
0
|
0
|
|
|
|
|
print $fileref $root->{docprolog} =~ /\([^\<*]*)/ ? |
|
188
|
|
|
|
|
|
|
$1 : $genre,"\n"; |
|
189
|
0
|
0
|
|
|
|
|
print $fileref "$1\n" if $root->{docprolog} =~ /\([^\<*]*)/; |
|
190
|
0
|
|
|
|
|
|
print $fileref ""; |
|
191
|
0
|
0
|
|
|
|
|
print $fileref $root->{docprolog} =~ /\([^\<*]*)/ ? |
|
192
|
|
|
|
|
|
|
$1 : $med,"\n"; |
|
193
|
0
|
0
|
|
|
|
|
print $fileref "$1\n" if $root->{docprolog} =~ /\([^\<*]*)/; |
|
194
|
0
|
0
|
|
|
|
|
print $fileref "$1\n" if $root->{docprolog} =~ /\([^\<*]*)/; |
|
195
|
0
|
0
|
|
|
|
|
print $fileref "$1\n" if $root->{docprolog} =~ /\([^\<*]*)/; |
|
196
|
0
|
0
|
|
|
|
|
print $fileref "$1\n" if $root->{docprolog} =~ /\([^\<*]*)/; |
|
197
|
0
|
|
|
|
|
|
print $fileref ""; |
|
198
|
0
|
0
|
|
|
|
|
print $fileref $root->{docprolog} =~ /\([^\<*]*)/ ? |
|
199
|
|
|
|
|
|
|
$1 : $temp,"\n"; |
|
200
|
0
|
0
|
|
|
|
|
print $fileref "$1\n" if $root->{docprolog} =~ /\([^\<*]*)/; |
|
201
|
0
|
|
|
|
|
|
print $fileref ""; |
|
202
|
0
|
0
|
|
|
|
|
print $fileref $root->{docprolog} =~ /\([^\<*]*)/ ? |
|
203
|
|
|
|
|
|
|
$1 : $authname,"\n"; |
|
204
|
0
|
0
|
|
|
|
|
print $fileref "$1\n" if $root->{docprolog} =~ /\([^\<*]*)/; |
|
205
|
0
|
|
|
|
|
|
print $fileref ""; |
|
206
|
0
|
0
|
|
|
|
|
print $fileref $root->{docprolog} =~ /\([^\<*]*)/ ? |
|
207
|
|
|
|
|
|
|
$1 : $opus,"\n"; |
|
208
|
0
|
|
|
|
|
|
print $fileref ""; |
|
209
|
0
|
0
|
|
|
|
|
print $fileref $root->{docprolog} =~ /\([^\<*]*)/ ? |
|
210
|
|
|
|
|
|
|
"$1\n" : "$id\n"; |
|
211
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
212
|
|
|
|
|
|
|
} |
|
213
|
0
|
0
|
0
|
|
|
|
if ($treeNo==1 or $root->{chap}) { |
|
214
|
0
|
0
|
0
|
|
|
|
print $fileref "\n" unless ($treeNo==1 or $root->{doc}.$root->{docid} ne ""); |
|
215
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
216
|
|
|
|
|
|
|
} |
|
217
|
0
|
0
|
0
|
|
|
|
if ($root->{para} or $treeNo==1) { |
|
218
|
0
|
0
|
|
|
|
|
my $n = $root->{para}=~/(\d+)/ ? $1 : 0; |
|
219
|
0
|
|
|
|
|
|
print $fileref " \n"; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
# print $fileref make_gap($root->{gappre}); |
|
222
|
0
|
|
|
|
|
|
my $id; |
|
223
|
0
|
0
|
|
|
|
|
if ($compatibility_mode) { |
|
224
|
0
|
|
|
|
|
|
$id=$root->{ID1}.$root->{lemid}.$root->{commentTR}; |
|
225
|
|
|
|
|
|
|
} else { |
|
226
|
0
|
|
|
|
|
|
$id=$root->{ID1}; |
|
227
|
|
|
|
|
|
|
} |
|
228
|
|
|
|
|
|
|
|
|
229
|
0
|
0
|
|
|
|
|
if ($root->{form}=~/alt/) { |
|
230
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
231
|
|
|
|
|
|
|
} else { |
|
232
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
233
|
|
|
|
|
|
|
} |
|
234
|
0
|
|
|
|
|
|
print $fileref make_gap($root->{gappost}); |
|
235
|
|
|
|
|
|
|
} |
|
236
|
|
|
|
|
|
|
# print node information |
|
237
|
0
|
|
|
|
|
|
foreach $node (@nodes) { |
|
238
|
0
|
|
|
|
|
|
print $fileref make_gap($node->{gappre}); |
|
239
|
0
|
0
|
0
|
|
|
|
if ($node->{origf} ne $node->{form} or $node->{origfkind} and $node->{origfkind} ne 'same') { |
|
|
|
|
0
|
|
|
|
|
|
240
|
0
|
|
|
|
|
|
my @w=split(/\|/,translate_to_entities($node->{origf})); |
|
241
|
0
|
|
|
|
|
|
my @k=split(/\|/,$node->{origfkind}); |
|
242
|
0
|
0
|
|
|
|
|
my $count=$#w > $#k ? $#w : $#k; |
|
243
|
0
|
|
|
|
|
|
for (my $i=0; $i<=$count; $i++ ) { |
|
244
|
0
|
0
|
0
|
|
|
|
if ($k[$i] and $k[$i] ne 'same' ) { |
|
245
|
0
|
|
|
|
|
|
print $fileref ""; |
|
246
|
|
|
|
|
|
|
} else { |
|
247
|
0
|
|
|
|
|
|
print $fileref ""; |
|
248
|
|
|
|
|
|
|
} |
|
249
|
0
|
|
|
|
|
|
print $fileref $w[$i],"\n"; |
|
250
|
|
|
|
|
|
|
} |
|
251
|
|
|
|
|
|
|
} |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
# choosing between f d and fadd |
|
254
|
2
|
0
|
|
2
|
|
945
|
if (index($node->{ord},'.')>=$[) { |
|
|
2
|
|
|
|
|
506
|
|
|
|
2
|
|
|
|
|
5388
|
|
|
|
0
|
|
|
|
|
|
|
|
255
|
0
|
0
|
|
|
|
|
my $del=$node->{del}=~/^(?:ELID|ELEX|EXPN|TRANSF)/i ? " ".lc($node->{del}) : ""; |
|
256
|
0
|
0
|
|
|
|
|
my $TID = $node->{TID} ne '' ? " id=\"$node->{TID}\"" : ""; |
|
257
|
0
|
|
|
|
|
|
print $fileref ""; |
|
258
|
|
|
|
|
|
|
} else { |
|
259
|
0
|
0
|
|
|
|
|
if ($compatibility_mode) { |
|
|
|
0
|
|
|
|
|
|
|
260
|
0
|
0
|
|
|
|
|
if ($node->{gap1}) { |
|
261
|
0
|
|
|
|
|
|
my $tags=$node->{gap1}; |
|
262
|
0
|
|
|
|
|
|
$tags=~s/\&nl;/\n/g; |
|
263
|
0
|
0
|
|
|
|
|
$tags.="\n" unless $tags=~/\
|
|
264
|
0
|
|
|
|
|
|
print $fileref $tags; |
|
265
|
0
|
|
|
|
|
|
print $fileref translate_to_entities($node->{form}); |
|
266
|
|
|
|
|
|
|
} else { |
|
267
|
0
|
|
|
|
|
|
print $fileref "",translate_to_entities($node->{form}); |
|
268
|
|
|
|
|
|
|
} |
|
269
|
|
|
|
|
|
|
} elsif ($node->{form}=~/^([][!"'()+,-.\/:;=\?`]|&(?:amp|ast|bsol|circ|commat|dollar|gt|lcub|lowbar|lsqb|lt|macron|num|percnt|rcub|rsqb|verbar);)$/) { |
|
270
|
0
|
0
|
|
|
|
|
my $case = $node->{formtype} eq 'gen' ? " ".$node->{formtype} : ""; |
|
271
|
0
|
0
|
|
|
|
|
my $AID = $node->{AID} ne '' ? " id=\"$node->{AID}\"" : ""; |
|
272
|
0
|
|
|
|
|
|
print $fileref "",translate_to_entities($node->{form}); |
|
273
|
|
|
|
|
|
|
} else { |
|
274
|
0
|
0
|
0
|
|
|
|
my $case = ($node->{formtype} ne "" and $node->{formtype} ne "lower") ? " ".$node->{formtype} : ""; |
|
275
|
0
|
0
|
|
|
|
|
my $AID = $node->{AID} ne '' ? " id=\"$node->{AID}\"" : ""; |
|
276
|
0
|
|
|
|
|
|
print $fileref "",$node->{form}; |
|
277
|
|
|
|
|
|
|
} |
|
278
|
0
|
|
|
|
|
|
print_split_attr($fileref,$node->{punct},'P'); |
|
279
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{alltags} if ($node->{alltags} ne ""); |
|
280
|
0
|
0
|
0
|
|
|
|
if (($node->{lemma} ne '' || $node->{tag} ne '') |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
281
|
|
|
|
|
|
|
&& !($node->{lemma} eq '-' && $node->{tag} eq '-') |
|
282
|
|
|
|
|
|
|
|| $node->{root} ne '' || $node->{ending} ne '' |
|
283
|
|
|
|
|
|
|
) { |
|
284
|
0
|
|
|
|
|
|
print_split_attr($fileref,translate_to_entities($node->{lemma}),'l'); |
|
285
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{root} if ($node->{root} ne ""); |
|
286
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{ending} if ($node->{root} ne ""); # this is not a mistake |
|
287
|
|
|
|
|
|
|
|
|
288
|
0
|
|
|
|
|
|
print_split_attr_with_num_attr($fileref,$node,'tag','wt','t','w'); |
|
289
|
|
|
|
|
|
|
} |
|
290
|
0
|
|
|
|
|
|
foreach (grep(/^lemmaMM_/,$fsfile->FS->attributes)) { |
|
291
|
0
|
|
|
|
|
|
/lemmaMM_(.*)$/; |
|
292
|
0
|
|
|
|
|
|
my $suf=$1; |
|
293
|
0
|
|
|
|
|
|
print_split_attr($fileref,$node->{$_},"MMl src=\"$suf\""); |
|
294
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{"rootMM_$suf"} if ($node->{"rootMM_$suf"} ne ""); |
|
295
|
|
|
|
|
|
|
# this is not a mistake |
|
296
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{"endingMM_$suf"} if ($node->{"rootMM_$suf"} ne ""); |
|
297
|
0
|
|
|
|
|
|
print_split_attr($fileref,$node->{"tagMM_$suf"},"MMt src=\"$suf\""); |
|
298
|
|
|
|
|
|
|
} |
|
299
|
0
|
|
|
|
|
|
foreach (grep(/^lemmaMD_/,$fsfile->FS->attributes)) { |
|
300
|
0
|
|
|
|
|
|
/lemmaMD_(.*)$/; |
|
301
|
0
|
|
|
|
|
|
my $suf=$1; |
|
302
|
0
|
|
|
|
|
|
print_split_attr_with_num_attr($fileref,$node,"lemmaMD_$suf","wMDl_$suf","MDl src=\"$suf\"",'w'); |
|
303
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{"rootMD_$suf"} if ($node->{"rootMD_$suf"} ne ""); |
|
304
|
|
|
|
|
|
|
# this is not a mistake |
|
305
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{"endingMD_$suf"} if ($node->{"rootMD_$suf"} ne ""); |
|
306
|
0
|
|
|
|
|
|
print_split_attr_with_num_attr($fileref,$node,"tagMD_$suf","wMDt_$suf","MDt src=\"$suf\"",'w'); |
|
307
|
|
|
|
|
|
|
} |
|
308
|
0
|
0
|
0
|
|
|
|
if ($node->{afun} and $node->{afun} ne "???") { |
|
309
|
0
|
|
|
|
|
|
my $afun_atrs=""; |
|
310
|
0
|
|
|
|
|
|
foreach my $afun (split(/\|/,$node->{afun})) { |
|
311
|
0
|
|
|
|
|
|
print $fileref "
|
|
312
|
0
|
0
|
|
|
|
|
$afun_atrs=join " ", grep { /./ && !/^no-/ } map { $node->{$_} } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
qw(parallel paren arabfa arabspec arabclaus); |
|
314
|
0
|
0
|
|
|
|
|
print $fileref (($afun_atrs ne "") ? " $afun_atrs>" : ">"),$afun; |
|
315
|
|
|
|
|
|
|
} |
|
316
|
|
|
|
|
|
|
} |
|
317
|
0
|
|
|
|
|
|
foreach (grep(/^afunMD_/,$fsfile->FS->attributes)) { |
|
318
|
0
|
|
|
|
|
|
/afunMD_(.*)$/; |
|
319
|
0
|
|
|
|
|
|
print_split_attr_with_num_attr($fileref,$node,"afunMD_$1","wMDA_$1","MDA src=\"$1\"",'w'); |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
# TODO: PDAT-specific attributes for MDA not yet supported |
|
322
|
|
|
|
|
|
|
} |
|
323
|
0
|
|
|
|
|
|
my $quot=""; |
|
324
|
0
|
0
|
|
|
|
|
if ($node->{dsp}=~/(DSPP|DSPI|DSP)/) { |
|
325
|
0
|
|
|
|
|
|
$quot=" ".lc($1); |
|
326
|
|
|
|
|
|
|
} |
|
327
|
0
|
0
|
|
|
|
|
if ($node->{quoted} eq 'QUOT') { |
|
328
|
0
|
0
|
|
|
|
|
$quot.= $quot ? ".quot" : " quot"; |
|
329
|
|
|
|
|
|
|
} |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
# |
|
332
|
|
|
|
|
|
|
# TODO: we need a mechanism to find out when TR information |
|
333
|
|
|
|
|
|
|
# is to be stored and when not |
|
334
|
|
|
|
|
|
|
# |
|
335
|
|
|
|
|
|
|
# we print if there is a trlemma or dord orders nodes or |
|
336
|
|
|
|
|
|
|
# there is a non-empty govTR and it is different from |
|
337
|
0
|
0
|
|
|
|
|
unless ($node->{del} eq 'TRANSF') { |
|
338
|
0
|
0
|
0
|
|
|
|
if (($fsfile->FS->exists('trlemma') and exists($node->{trlemma}) and $node->{trlemma} ne "") or |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
339
|
|
|
|
|
|
|
$fsfile->FS->order eq 'dord' |
|
340
|
|
|
|
|
|
|
# or |
|
341
|
|
|
|
|
|
|
# ($fsfile->FS->exists('govTR') and |
|
342
|
|
|
|
|
|
|
# exists($node->{govTR}) and |
|
343
|
|
|
|
|
|
|
# $node->{govTR} ne "" and |
|
344
|
|
|
|
|
|
|
# $node->{govTR} != $node->parent->{ord}) |
|
345
|
|
|
|
|
|
|
) { |
|
346
|
|
|
|
|
|
|
|
|
347
|
0
|
|
|
|
|
|
print $fileref "
|
|
348
|
0
|
0
|
|
|
|
|
print $fileref " hidden" if ($node->{"TR"} eq "hide"); |
|
349
|
|
|
|
|
|
|
print $fileref " origin=\"".join(" ",split /\|/,$node->{"AIDREFS"}). |
|
350
|
0
|
0
|
|
|
|
|
"\"" if $node->{"AIDREFS"} ne ""; |
|
351
|
0
|
|
|
|
|
|
print $fileref ">",translate_to_entities($node->{trlemma}); |
|
352
|
|
|
|
|
|
|
|
|
353
|
0
|
0
|
0
|
|
|
|
if ($node->{func} ne "" or $node->{gram} ne "") { |
|
354
|
0
|
|
|
|
|
|
print $fileref "",$node->{func}; |
|
355
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{gram} if ($node->{gram} !~ /^(?:---|\?\?\?)?$/); |
|
356
|
|
|
|
|
|
|
} |
|
357
|
|
|
|
|
|
|
print $fileref "",$node->{memberof} if ($node->{memberof} ne "" and |
|
358
|
0
|
0
|
0
|
|
|
|
$node->{memberof} ne "???"); |
|
359
|
|
|
|
|
|
|
print $fileref "",$node->{parenthesis} if ($node->{parenthesis} ne "" and |
|
360
|
0
|
0
|
0
|
|
|
|
$node->{parenthesis} ne "???"); |
|
361
|
|
|
|
|
|
|
print $fileref "",$node->{operand} if ($node->{operand} ne "" and |
|
362
|
0
|
0
|
0
|
|
|
|
$node->{operand} ne "???"); |
|
363
|
0
|
|
|
|
|
|
my $TRt=make_TRt($node,0); |
|
364
|
0
|
0
|
|
|
|
|
print $fileref "",$TRt unless ($TRt=~/^X*$/); |
|
365
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{tfa} if ($node->{tfa} !~ /^(?:---|\?\?\?)?$/); |
|
366
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{dord} if ($node->{dord} ne ""); |
|
367
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{fw} if ($node->{fw} ne ""); |
|
368
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{phraseme} if ($node->{phraseme} ne ""); |
|
369
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{frameid} if ($node->{frameid} ne ""); |
|
370
|
|
|
|
|
|
|
print $fileref "",translate_to_entities($node->{framere}) |
|
371
|
0
|
0
|
|
|
|
|
if ($node->{framere} ne ""); |
|
372
|
0
|
0
|
0
|
|
|
|
if($gov eq 'govTR' or |
|
|
|
|
0
|
|
|
|
|
|
373
|
|
|
|
|
|
|
!defined($gov) and $fsfile->FS->order eq 'dord') { |
|
374
|
0
|
|
|
|
|
|
print $fileref "",$node->parent->{ord}; |
|
375
|
|
|
|
|
|
|
} else { |
|
376
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{govTR} if ($node->{govTR} ne ""); |
|
377
|
|
|
|
|
|
|
} |
|
378
|
0
|
|
|
|
|
|
do { |
|
379
|
0
|
|
|
|
|
|
my @corefs=split /\|/,$node->{coref}; |
|
380
|
0
|
|
|
|
|
|
my @cortypes=split /\|/,$node->{cortype}; |
|
381
|
0
|
|
|
|
|
|
foreach (@corefs) { |
|
382
|
0
|
|
|
|
|
|
print $fileref ""; |
|
383
|
|
|
|
|
|
|
} |
|
384
|
0
|
|
|
|
|
|
foreach (split /\|/,$node->{corlemma}) { |
|
385
|
0
|
|
|
|
|
|
print $fileref "$_"; |
|
386
|
|
|
|
|
|
|
} |
|
387
|
|
|
|
|
|
|
} |
|
388
|
|
|
|
|
|
|
} |
|
389
|
|
|
|
|
|
|
} |
|
390
|
0
|
|
|
|
|
|
foreach (grep(/^trlemmaM_/,$fsfile->FS->attributes)) { |
|
391
|
0
|
|
|
|
|
|
/^trlemmaM_(.*)$/; |
|
392
|
0
|
|
|
|
|
|
print $fileref "
|
|
393
|
0
|
0
|
|
|
|
|
print $fileref " hidden" if ($node->{"MTR_$1"} eq "hide"); |
|
394
|
0
|
|
|
|
|
|
print $fileref " src=\"$1\""; |
|
395
|
0
|
0
|
|
|
|
|
print $fileref " origin=\"".join(" ",split /\|/,$node->{"MAIDREFS_$1"})."\"" if $node->{"MAIDREFS_$1"} ne "";; |
|
396
|
0
|
|
|
|
|
|
print $fileref ">",$node->{$_}; |
|
397
|
|
|
|
|
|
|
# actually, all the set of MTRl subelements should be |
|
398
|
|
|
|
|
|
|
# treated the same (plus hide |
|
399
|
|
|
|
|
|
|
# |
|
400
|
|
|
|
|
|
|
# TODO: IMPLEMENTATION MISSING |
|
401
|
|
|
|
|
|
|
# |
|
402
|
|
|
|
|
|
|
} |
|
403
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{ord} if ($node->{ord} ne ""); |
|
404
|
0
|
0
|
|
|
|
|
if ($node->{TID} eq '') { |
|
405
|
0
|
0
|
0
|
|
|
|
if (defined($gov) and $gov ne 'ordorig' |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
406
|
|
|
|
|
|
|
or |
|
407
|
|
|
|
|
|
|
!defined($gov) and $fsfile->FS->order eq 'dord') { |
|
408
|
0
|
0
|
|
|
|
|
print $fileref "",$node->{ordorig} if $node->{ordorig} ne ""; |
|
409
|
|
|
|
|
|
|
} else { |
|
410
|
0
|
0
|
0
|
|
|
|
print $fileref "",int($node->parent->{ord}) if (($export_dependency || $node->parent->{ord} ne "0") and $node->parent->{ord} ne ""); |
|
|
|
|
0
|
|
|
|
|
|
411
|
|
|
|
|
|
|
} |
|
412
|
|
|
|
|
|
|
} |
|
413
|
0
|
0
|
|
|
|
|
unless (index($node->{ord},'.')>=$[) { |
|
414
|
|
|
|
|
|
|
#not allowed in DTD for some reason |
|
415
|
0
|
|
|
|
|
|
foreach (grep(/^govMD_/,$fsfile->FS->attributes)) { |
|
416
|
0
|
0
|
|
|
|
|
if ($gov ne $_) { |
|
417
|
0
|
|
|
|
|
|
/govMD_(.*)$/; |
|
418
|
0
|
|
|
|
|
|
print_split_attr_with_num_attr($fileref,$node,"govMD_$1","wMDg_$1","MDg src=\"$1\"",'w'); |
|
419
|
|
|
|
|
|
|
} |
|
420
|
|
|
|
|
|
|
} |
|
421
|
0
|
0
|
|
|
|
|
if ($gov=~/^govMD_(.*)$/) { |
|
422
|
|
|
|
|
|
|
print $fileref "
|
|
423
|
|
|
|
|
|
|
($node->{"wMDg_$1"} ne "" ? "w=".$node->{"wMDg_$1"} : ""), |
|
424
|
0
|
0
|
|
|
|
|
">",$node->parent->{ord}; |
|
425
|
|
|
|
|
|
|
} |
|
426
|
|
|
|
|
|
|
} |
|
427
|
0
|
0
|
|
|
|
|
if (join("",map { $node->{"wsd$_"} } qw(s ewn ili iliOffset)) ne "") { |
|
|
0
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
print $fileref "
|
|
429
|
0
|
|
|
|
|
|
join ("",map { " $_='".$node->{"wsd$_"}."'" } grep { $node->{"wsd$_"} ne "" } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
qw(s ewn ili iliOffset)),">"; |
|
431
|
|
|
|
|
|
|
} |
|
432
|
|
|
|
|
|
|
# get a list of unique attributes |
|
433
|
0
|
|
|
|
|
|
my %xtra; |
|
434
|
|
|
|
|
|
|
@xtra{ |
|
435
|
0
|
|
|
|
|
|
@extra_attributes, |
|
436
|
|
|
|
|
|
|
grep(/^x_/,$fsfile->FS->attributes()) |
|
437
|
|
|
|
|
|
|
}=(); |
|
438
|
0
|
|
|
|
|
|
foreach (sort {$a cmp $b} keys %xtra) { |
|
|
0
|
|
|
|
|
|
|
|
439
|
0
|
|
|
|
|
|
my $name=$_; $name=~s/^x_//; |
|
|
0
|
|
|
|
|
|
|
|
440
|
0
|
0
|
|
|
|
|
if ($gov ne "x_".$name) { |
|
441
|
|
|
|
|
|
|
print $fileref "", |
|
442
|
0
|
0
|
|
|
|
|
translate_to_entities($node->{$_}) if $node->{$_} ne ""; |
|
443
|
|
|
|
|
|
|
} |
|
444
|
|
|
|
|
|
|
} |
|
445
|
0
|
0
|
|
|
|
|
if ($gov =~ /^x_(.*)$/) { |
|
446
|
0
|
|
|
|
|
|
print $fileref "",$node->parent->{ord}; |
|
447
|
|
|
|
|
|
|
} |
|
448
|
0
|
0
|
0
|
|
|
|
if ($preserve_err1 and $node->{err1} ne "") { |
|
449
|
0
|
|
|
|
|
|
print $fileref "",$node->{err1}; |
|
450
|
|
|
|
|
|
|
} |
|
451
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
452
|
0
|
0
|
|
|
|
|
print $fileref "\n" if ($node->{nospace}); |
|
453
|
0
|
|
|
|
|
|
print $fileref make_gap($node->{gappost}); |
|
454
|
|
|
|
|
|
|
} |
|
455
|
|
|
|
|
|
|
# print file ending |
|
456
|
|
|
|
|
|
|
} |
|
457
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
458
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
459
|
0
|
|
|
|
|
|
print $fileref "\n"; |
|
460
|
|
|
|
|
|
|
|
|
461
|
0
|
|
|
|
|
|
return 1; |
|
462
|
|
|
|
|
|
|
} |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
1; |