line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#################################################################### |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This file was generated using Parse::Yapp version 1.05. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Don't edit this file, use source file instead. |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# ANY CHANGE MADE HERE WILL BE LOST ! |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
#################################################################### |
10
|
|
|
|
|
|
|
package Lingua::YaTeA::ParsingPatternParser; |
11
|
5
|
|
|
5
|
|
36
|
use vars qw ( @ISA ); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
310
|
|
12
|
5
|
|
|
5
|
|
34
|
use strict; |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
151
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
@ISA= qw ( Parse::Yapp::Driver ); |
15
|
5
|
|
|
5
|
|
2771
|
use Parse::Yapp::Driver; |
|
5
|
|
|
|
|
10786
|
|
|
5
|
|
|
|
|
76
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#line 12 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Lingua::YaTeA; |
20
|
|
|
|
|
|
|
# use Data::Dumper; |
21
|
|
|
|
|
|
|
use warnings; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $node_set; |
24
|
|
|
|
|
|
|
my $level = 0; |
25
|
|
|
|
|
|
|
my $node; |
26
|
|
|
|
|
|
|
my @uncomplete; |
27
|
|
|
|
|
|
|
my @parse; |
28
|
|
|
|
|
|
|
my $edge; |
29
|
|
|
|
|
|
|
my $num_content_words; |
30
|
|
|
|
|
|
|
my @pos_sequence; |
31
|
|
|
|
|
|
|
my $priority; |
32
|
|
|
|
|
|
|
my $direction; |
33
|
|
|
|
|
|
|
my $pos_sequence; |
34
|
|
|
|
|
|
|
my $pattern; |
35
|
|
|
|
|
|
|
my $parse; |
36
|
|
|
|
|
|
|
my $num_line = 1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new { |
40
|
|
|
|
|
|
|
my($class)=shift; |
41
|
|
|
|
|
|
|
ref($class) |
42
|
|
|
|
|
|
|
and $class=ref($class); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my($self)=$class->SUPER::new( yyversion => '1.05', |
45
|
|
|
|
|
|
|
yystates => |
46
|
|
|
|
|
|
|
[ |
47
|
|
|
|
|
|
|
{#State 0 |
48
|
|
|
|
|
|
|
DEFAULT => -1, |
49
|
|
|
|
|
|
|
GOTOS => { |
50
|
|
|
|
|
|
|
'input' => 1 |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
}, |
53
|
|
|
|
|
|
|
{#State 1 |
54
|
|
|
|
|
|
|
ACTIONS => { |
55
|
|
|
|
|
|
|
'' => 2, |
56
|
|
|
|
|
|
|
"\n" => 5, |
57
|
|
|
|
|
|
|
'error' => 6, |
58
|
|
|
|
|
|
|
'OPEN_TAG' => -6 |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
GOTOS => { |
61
|
|
|
|
|
|
|
'parsingpattern' => 4, |
62
|
|
|
|
|
|
|
'@1-0' => 3, |
63
|
|
|
|
|
|
|
'line' => 7 |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
}, |
66
|
|
|
|
|
|
|
{#State 2 |
67
|
|
|
|
|
|
|
DEFAULT => 0 |
68
|
|
|
|
|
|
|
}, |
69
|
|
|
|
|
|
|
{#State 3 |
70
|
|
|
|
|
|
|
ACTIONS => { |
71
|
|
|
|
|
|
|
'error' => 9, |
72
|
|
|
|
|
|
|
'OPEN_TAG' => 10 |
73
|
|
|
|
|
|
|
}, |
74
|
|
|
|
|
|
|
GOTOS => { |
75
|
|
|
|
|
|
|
'OPEN' => 8 |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
}, |
78
|
|
|
|
|
|
|
{#State 4 |
79
|
|
|
|
|
|
|
ACTIONS => { |
80
|
|
|
|
|
|
|
"\n" => 11 |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
{#State 5 |
84
|
|
|
|
|
|
|
DEFAULT => -3 |
85
|
|
|
|
|
|
|
}, |
86
|
|
|
|
|
|
|
{#State 6 |
87
|
|
|
|
|
|
|
ACTIONS => { |
88
|
|
|
|
|
|
|
"\n" => 12, |
89
|
|
|
|
|
|
|
"parsingpattern" => 13 |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
}, |
92
|
|
|
|
|
|
|
{#State 7 |
93
|
|
|
|
|
|
|
DEFAULT => -2 |
94
|
|
|
|
|
|
|
}, |
95
|
|
|
|
|
|
|
{#State 8 |
96
|
|
|
|
|
|
|
ACTIONS => { |
97
|
|
|
|
|
|
|
'error' => 17, |
98
|
|
|
|
|
|
|
'OPEN_TAG' => 10, |
99
|
|
|
|
|
|
|
'CANDIDATE_TAG' => 18 |
100
|
|
|
|
|
|
|
}, |
101
|
|
|
|
|
|
|
GOTOS => { |
102
|
|
|
|
|
|
|
'OPEN' => 14, |
103
|
|
|
|
|
|
|
'pattern' => 15, |
104
|
|
|
|
|
|
|
'CANDIDATE' => 16 |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
}, |
107
|
|
|
|
|
|
|
{#State 9 |
108
|
|
|
|
|
|
|
ACTIONS => { |
109
|
|
|
|
|
|
|
"\nOPEN: " => 19 |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
}, |
112
|
|
|
|
|
|
|
{#State 10 |
113
|
|
|
|
|
|
|
DEFAULT => -15 |
114
|
|
|
|
|
|
|
}, |
115
|
|
|
|
|
|
|
{#State 11 |
116
|
|
|
|
|
|
|
DEFAULT => -4 |
117
|
|
|
|
|
|
|
}, |
118
|
|
|
|
|
|
|
{#State 12 |
119
|
|
|
|
|
|
|
DEFAULT => -5 |
120
|
|
|
|
|
|
|
}, |
121
|
|
|
|
|
|
|
{#State 13 |
122
|
|
|
|
|
|
|
DEFAULT => -8 |
123
|
|
|
|
|
|
|
}, |
124
|
|
|
|
|
|
|
{#State 14 |
125
|
|
|
|
|
|
|
ACTIONS => { |
126
|
|
|
|
|
|
|
'error' => 17, |
127
|
|
|
|
|
|
|
'OPEN_TAG' => 10, |
128
|
|
|
|
|
|
|
'CANDIDATE_TAG' => 18 |
129
|
|
|
|
|
|
|
}, |
130
|
|
|
|
|
|
|
GOTOS => { |
131
|
|
|
|
|
|
|
'OPEN' => 14, |
132
|
|
|
|
|
|
|
'pattern' => 20, |
133
|
|
|
|
|
|
|
'CANDIDATE' => 16 |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
}, |
136
|
|
|
|
|
|
|
{#State 15 |
137
|
|
|
|
|
|
|
ACTIONS => { |
138
|
|
|
|
|
|
|
'END_TAG' => 21, |
139
|
|
|
|
|
|
|
'error' => 22 |
140
|
|
|
|
|
|
|
}, |
141
|
|
|
|
|
|
|
GOTOS => { |
142
|
|
|
|
|
|
|
'END' => 23 |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
}, |
145
|
|
|
|
|
|
|
{#State 16 |
146
|
|
|
|
|
|
|
ACTIONS => { |
147
|
|
|
|
|
|
|
'DET_TAG' => 26, |
148
|
|
|
|
|
|
|
'error' => 28, |
149
|
|
|
|
|
|
|
'OPEN_TAG' => 10, |
150
|
|
|
|
|
|
|
'CANDIDATE_TAG' => 18, |
151
|
|
|
|
|
|
|
'PREP_TAG' => 25 |
152
|
|
|
|
|
|
|
}, |
153
|
|
|
|
|
|
|
GOTOS => { |
154
|
|
|
|
|
|
|
'OPEN' => 14, |
155
|
|
|
|
|
|
|
'PREP' => 27, |
156
|
|
|
|
|
|
|
'CANDIDATE' => 24, |
157
|
|
|
|
|
|
|
'DET' => 29 |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
}, |
160
|
|
|
|
|
|
|
{#State 17 |
161
|
|
|
|
|
|
|
ACTIONS => { |
162
|
|
|
|
|
|
|
"\nCANDIDATE: " => 30, |
163
|
|
|
|
|
|
|
"\nOPEN: " => 19, |
164
|
|
|
|
|
|
|
"\nnew_pattern: " => 31 |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
}, |
167
|
|
|
|
|
|
|
{#State 18 |
168
|
|
|
|
|
|
|
ACTIONS => { |
169
|
|
|
|
|
|
|
'POSITION_TAG' => 32 |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
}, |
172
|
|
|
|
|
|
|
{#State 19 |
173
|
|
|
|
|
|
|
DEFAULT => -16 |
174
|
|
|
|
|
|
|
}, |
175
|
|
|
|
|
|
|
{#State 20 |
176
|
|
|
|
|
|
|
ACTIONS => { |
177
|
|
|
|
|
|
|
'CLOSE_TAG' => 34, |
178
|
|
|
|
|
|
|
'error' => 35 |
179
|
|
|
|
|
|
|
}, |
180
|
|
|
|
|
|
|
GOTOS => { |
181
|
|
|
|
|
|
|
'CLOSE' => 33 |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
}, |
184
|
|
|
|
|
|
|
{#State 21 |
185
|
|
|
|
|
|
|
DEFAULT => -26 |
186
|
|
|
|
|
|
|
}, |
187
|
|
|
|
|
|
|
{#State 22 |
188
|
|
|
|
|
|
|
ACTIONS => { |
189
|
|
|
|
|
|
|
"\nEND: " => 36 |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
}, |
192
|
|
|
|
|
|
|
{#State 23 |
193
|
|
|
|
|
|
|
ACTIONS => { |
194
|
|
|
|
|
|
|
'PRIORITY_TAG' => 38, |
195
|
|
|
|
|
|
|
'error' => 39 |
196
|
|
|
|
|
|
|
}, |
197
|
|
|
|
|
|
|
GOTOS => { |
198
|
|
|
|
|
|
|
'priority' => 37 |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
}, |
201
|
|
|
|
|
|
|
{#State 24 |
202
|
|
|
|
|
|
|
DEFAULT => -13 |
203
|
|
|
|
|
|
|
}, |
204
|
|
|
|
|
|
|
{#State 25 |
205
|
|
|
|
|
|
|
DEFAULT => -20 |
206
|
|
|
|
|
|
|
}, |
207
|
|
|
|
|
|
|
{#State 26 |
208
|
|
|
|
|
|
|
DEFAULT => -22 |
209
|
|
|
|
|
|
|
}, |
210
|
|
|
|
|
|
|
{#State 27 |
211
|
|
|
|
|
|
|
ACTIONS => { |
212
|
|
|
|
|
|
|
'DET_TAG' => 26, |
213
|
|
|
|
|
|
|
'error' => 28, |
214
|
|
|
|
|
|
|
'OPEN_TAG' => 10, |
215
|
|
|
|
|
|
|
'CANDIDATE_TAG' => 18, |
216
|
|
|
|
|
|
|
'PREP_TAG' => 25 |
217
|
|
|
|
|
|
|
}, |
218
|
|
|
|
|
|
|
GOTOS => { |
219
|
|
|
|
|
|
|
'OPEN' => 14, |
220
|
|
|
|
|
|
|
'PREP' => 41, |
221
|
|
|
|
|
|
|
'CANDIDATE' => 40, |
222
|
|
|
|
|
|
|
'DET' => 42 |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
}, |
225
|
|
|
|
|
|
|
{#State 28 |
226
|
|
|
|
|
|
|
ACTIONS => { |
227
|
|
|
|
|
|
|
"\nCANDIDATE: " => 30, |
228
|
|
|
|
|
|
|
"\nDET: " => 43, |
229
|
|
|
|
|
|
|
"\nOPEN: " => 19, |
230
|
|
|
|
|
|
|
"\nPREP: " => 44 |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
}, |
233
|
|
|
|
|
|
|
{#State 29 |
234
|
|
|
|
|
|
|
ACTIONS => { |
235
|
|
|
|
|
|
|
'error' => 46, |
236
|
|
|
|
|
|
|
'OPEN_TAG' => 10, |
237
|
|
|
|
|
|
|
'CANDIDATE_TAG' => 18 |
238
|
|
|
|
|
|
|
}, |
239
|
|
|
|
|
|
|
GOTOS => { |
240
|
|
|
|
|
|
|
'OPEN' => 14, |
241
|
|
|
|
|
|
|
'CANDIDATE' => 45 |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
}, |
244
|
|
|
|
|
|
|
{#State 30 |
245
|
|
|
|
|
|
|
DEFAULT => -19 |
246
|
|
|
|
|
|
|
}, |
247
|
|
|
|
|
|
|
{#State 31 |
248
|
|
|
|
|
|
|
DEFAULT => -14 |
249
|
|
|
|
|
|
|
}, |
250
|
|
|
|
|
|
|
{#State 32 |
251
|
|
|
|
|
|
|
DEFAULT => -17 |
252
|
|
|
|
|
|
|
}, |
253
|
|
|
|
|
|
|
{#State 33 |
254
|
|
|
|
|
|
|
DEFAULT => -18 |
255
|
|
|
|
|
|
|
}, |
256
|
|
|
|
|
|
|
{#State 34 |
257
|
|
|
|
|
|
|
DEFAULT => -24 |
258
|
|
|
|
|
|
|
}, |
259
|
|
|
|
|
|
|
{#State 35 |
260
|
|
|
|
|
|
|
ACTIONS => { |
261
|
|
|
|
|
|
|
"\nCLOSE: " => 47 |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
}, |
264
|
|
|
|
|
|
|
{#State 36 |
265
|
|
|
|
|
|
|
DEFAULT => -27 |
266
|
|
|
|
|
|
|
}, |
267
|
|
|
|
|
|
|
{#State 37 |
268
|
|
|
|
|
|
|
ACTIONS => { |
269
|
|
|
|
|
|
|
'DIRECTION_TAG' => 49, |
270
|
|
|
|
|
|
|
'error' => 50 |
271
|
|
|
|
|
|
|
}, |
272
|
|
|
|
|
|
|
GOTOS => { |
273
|
|
|
|
|
|
|
'direction' => 48 |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
}, |
276
|
|
|
|
|
|
|
{#State 38 |
277
|
|
|
|
|
|
|
DEFAULT => -28 |
278
|
|
|
|
|
|
|
}, |
279
|
|
|
|
|
|
|
{#State 39 |
280
|
|
|
|
|
|
|
ACTIONS => { |
281
|
|
|
|
|
|
|
"\npriority: " => 51 |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
}, |
284
|
|
|
|
|
|
|
{#State 40 |
285
|
|
|
|
|
|
|
DEFAULT => -10 |
286
|
|
|
|
|
|
|
}, |
287
|
|
|
|
|
|
|
{#State 41 |
288
|
|
|
|
|
|
|
ACTIONS => { |
289
|
|
|
|
|
|
|
'error' => 46, |
290
|
|
|
|
|
|
|
'OPEN_TAG' => 10, |
291
|
|
|
|
|
|
|
'CANDIDATE_TAG' => 18 |
292
|
|
|
|
|
|
|
}, |
293
|
|
|
|
|
|
|
GOTOS => { |
294
|
|
|
|
|
|
|
'OPEN' => 14, |
295
|
|
|
|
|
|
|
'CANDIDATE' => 52 |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
}, |
298
|
|
|
|
|
|
|
{#State 42 |
299
|
|
|
|
|
|
|
ACTIONS => { |
300
|
|
|
|
|
|
|
'error' => 46, |
301
|
|
|
|
|
|
|
'OPEN_TAG' => 10, |
302
|
|
|
|
|
|
|
'CANDIDATE_TAG' => 18 |
303
|
|
|
|
|
|
|
}, |
304
|
|
|
|
|
|
|
GOTOS => { |
305
|
|
|
|
|
|
|
'OPEN' => 14, |
306
|
|
|
|
|
|
|
'CANDIDATE' => 53 |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
}, |
309
|
|
|
|
|
|
|
{#State 43 |
310
|
|
|
|
|
|
|
DEFAULT => -23 |
311
|
|
|
|
|
|
|
}, |
312
|
|
|
|
|
|
|
{#State 44 |
313
|
|
|
|
|
|
|
DEFAULT => -21 |
314
|
|
|
|
|
|
|
}, |
315
|
|
|
|
|
|
|
{#State 45 |
316
|
|
|
|
|
|
|
DEFAULT => -12 |
317
|
|
|
|
|
|
|
}, |
318
|
|
|
|
|
|
|
{#State 46 |
319
|
|
|
|
|
|
|
ACTIONS => { |
320
|
|
|
|
|
|
|
"\nCANDIDATE: " => 30, |
321
|
|
|
|
|
|
|
"\nOPEN: " => 19 |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
}, |
324
|
|
|
|
|
|
|
{#State 47 |
325
|
|
|
|
|
|
|
DEFAULT => -25 |
326
|
|
|
|
|
|
|
}, |
327
|
|
|
|
|
|
|
{#State 48 |
328
|
|
|
|
|
|
|
DEFAULT => -7 |
329
|
|
|
|
|
|
|
}, |
330
|
|
|
|
|
|
|
{#State 49 |
331
|
|
|
|
|
|
|
DEFAULT => -30 |
332
|
|
|
|
|
|
|
}, |
333
|
|
|
|
|
|
|
{#State 50 |
334
|
|
|
|
|
|
|
ACTIONS => { |
335
|
|
|
|
|
|
|
"\ndirection: " => 54 |
336
|
|
|
|
|
|
|
} |
337
|
|
|
|
|
|
|
}, |
338
|
|
|
|
|
|
|
{#State 51 |
339
|
|
|
|
|
|
|
DEFAULT => -29 |
340
|
|
|
|
|
|
|
}, |
341
|
|
|
|
|
|
|
{#State 52 |
342
|
|
|
|
|
|
|
DEFAULT => -11 |
343
|
|
|
|
|
|
|
}, |
344
|
|
|
|
|
|
|
{#State 53 |
345
|
|
|
|
|
|
|
DEFAULT => -9 |
346
|
|
|
|
|
|
|
}, |
347
|
|
|
|
|
|
|
{#State 54 |
348
|
|
|
|
|
|
|
DEFAULT => -31 |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
], |
351
|
|
|
|
|
|
|
yyrules => |
352
|
|
|
|
|
|
|
[ |
353
|
|
|
|
|
|
|
[#Rule 0 |
354
|
|
|
|
|
|
|
'$start', 2, undef |
355
|
|
|
|
|
|
|
], |
356
|
|
|
|
|
|
|
[#Rule 1 |
357
|
|
|
|
|
|
|
'input', 0, undef |
358
|
|
|
|
|
|
|
], |
359
|
|
|
|
|
|
|
[#Rule 2 |
360
|
|
|
|
|
|
|
'input', 2, |
361
|
|
|
|
|
|
|
sub |
362
|
|
|
|
|
|
|
#line 34 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
363
|
|
|
|
|
|
|
{ # print STDERR "INPUT $_[1] \n"; |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
], |
366
|
|
|
|
|
|
|
[#Rule 3 |
367
|
|
|
|
|
|
|
'line', 1, |
368
|
|
|
|
|
|
|
sub |
369
|
|
|
|
|
|
|
#line 38 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
370
|
|
|
|
|
|
|
{ $_[1] } |
371
|
|
|
|
|
|
|
], |
372
|
|
|
|
|
|
|
[#Rule 4 |
373
|
|
|
|
|
|
|
'line', 2, |
374
|
|
|
|
|
|
|
sub |
375
|
|
|
|
|
|
|
#line 39 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
376
|
|
|
|
|
|
|
{ |
377
|
|
|
|
|
|
|
# print STDERR "=>$_[1]\n"; |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
$pos_sequence = join(" ",@pos_sequence); |
380
|
|
|
|
|
|
|
$parse = join(" ",@parse); |
381
|
|
|
|
|
|
|
# print STDERR "parse = $parse\n"; |
382
|
|
|
|
|
|
|
$node_set->setRoot; |
383
|
|
|
|
|
|
|
$pattern = Lingua::YaTeA::ParsingPattern->new($parse,$pos_sequence,$node_set,$priority,$direction,$num_content_words,$num_line); |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
$_[0]->YYData->{PPRS}->addPattern($pattern); |
386
|
|
|
|
|
|
|
@pos_sequence = (); |
387
|
|
|
|
|
|
|
@uncomplete = (); |
388
|
|
|
|
|
|
|
@parse = (); |
389
|
|
|
|
|
|
|
$level = 0; |
390
|
|
|
|
|
|
|
$_[0]->YYData->{PPRS}->checkContentWords($num_content_words,$num_line); |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
if ($num_content_words > $Lingua::YaTeA::ParsingPatternRecordSet::max_content_words) |
393
|
|
|
|
|
|
|
{ |
394
|
|
|
|
|
|
|
$Lingua::YaTeA::ParsingPatternRecordSet::max_content_words = $num_content_words; |
395
|
|
|
|
|
|
|
} |
396
|
|
|
|
|
|
|
$num_content_words = 0; |
397
|
|
|
|
|
|
|
$num_line++; |
398
|
|
|
|
|
|
|
} |
399
|
|
|
|
|
|
|
], |
400
|
|
|
|
|
|
|
[#Rule 5 |
401
|
|
|
|
|
|
|
'line', 2, |
402
|
|
|
|
|
|
|
sub |
403
|
|
|
|
|
|
|
#line 62 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
404
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
405
|
|
|
|
|
|
|
], |
406
|
|
|
|
|
|
|
[#Rule 6 |
407
|
|
|
|
|
|
|
'@1-0', 0, |
408
|
|
|
|
|
|
|
sub |
409
|
|
|
|
|
|
|
#line 65 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
410
|
|
|
|
|
|
|
{ # print STDERR "START\n"; |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
$node_set = Lingua::YaTeA::NodeSet->new; |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
} |
415
|
|
|
|
|
|
|
], |
416
|
|
|
|
|
|
|
[#Rule 7 |
417
|
|
|
|
|
|
|
'parsingpattern', 6, undef |
418
|
|
|
|
|
|
|
], |
419
|
|
|
|
|
|
|
[#Rule 8 |
420
|
|
|
|
|
|
|
'parsingpattern', 2, |
421
|
|
|
|
|
|
|
sub |
422
|
|
|
|
|
|
|
#line 70 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
423
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
424
|
|
|
|
|
|
|
], |
425
|
|
|
|
|
|
|
[#Rule 9 |
426
|
|
|
|
|
|
|
'pattern', 4, undef |
427
|
|
|
|
|
|
|
], |
428
|
|
|
|
|
|
|
[#Rule 10 |
429
|
|
|
|
|
|
|
'pattern', 3, undef |
430
|
|
|
|
|
|
|
], |
431
|
|
|
|
|
|
|
[#Rule 11 |
432
|
|
|
|
|
|
|
'pattern', 4, undef |
433
|
|
|
|
|
|
|
], |
434
|
|
|
|
|
|
|
[#Rule 12 |
435
|
|
|
|
|
|
|
'pattern', 3, undef |
436
|
|
|
|
|
|
|
], |
437
|
|
|
|
|
|
|
[#Rule 13 |
438
|
|
|
|
|
|
|
'pattern', 2, undef |
439
|
|
|
|
|
|
|
], |
440
|
|
|
|
|
|
|
[#Rule 14 |
441
|
|
|
|
|
|
|
'pattern', 2, |
442
|
|
|
|
|
|
|
sub |
443
|
|
|
|
|
|
|
#line 79 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
444
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
445
|
|
|
|
|
|
|
], |
446
|
|
|
|
|
|
|
[#Rule 15 |
447
|
|
|
|
|
|
|
'OPEN', 1, |
448
|
|
|
|
|
|
|
sub |
449
|
|
|
|
|
|
|
#line 82 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
450
|
|
|
|
|
|
|
{# print STDERR "OPEN $_[1]\n"; |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
if ($level == 0) |
453
|
|
|
|
|
|
|
{ |
454
|
|
|
|
|
|
|
$node = Lingua::YaTeA::RootNode->new($level); |
455
|
|
|
|
|
|
|
} |
456
|
|
|
|
|
|
|
else |
457
|
|
|
|
|
|
|
{ |
458
|
|
|
|
|
|
|
$node = Lingua::YaTeA::InternalNode->new($level); |
459
|
|
|
|
|
|
|
} |
460
|
|
|
|
|
|
|
$node_set->addNode($node); |
461
|
|
|
|
|
|
|
push @uncomplete, $node; |
462
|
|
|
|
|
|
|
$level++; |
463
|
|
|
|
|
|
|
push @parse, $_[1]; |
464
|
|
|
|
|
|
|
} |
465
|
|
|
|
|
|
|
], |
466
|
|
|
|
|
|
|
[#Rule 16 |
467
|
|
|
|
|
|
|
'OPEN', 2, |
468
|
|
|
|
|
|
|
sub |
469
|
|
|
|
|
|
|
#line 97 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
470
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
471
|
|
|
|
|
|
|
], |
472
|
|
|
|
|
|
|
[#Rule 17 |
473
|
|
|
|
|
|
|
'CANDIDATE', 2, |
474
|
|
|
|
|
|
|
sub |
475
|
|
|
|
|
|
|
#line 100 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
476
|
|
|
|
|
|
|
{ |
477
|
|
|
|
|
|
|
# print STDERR "CANDIDATE $_[1] $_[2]\n"; |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
$edge = Lingua::YaTeA::PatternLeaf->new($_[1],$node); |
480
|
|
|
|
|
|
|
$node->addEdge($edge,$_[2]); |
481
|
|
|
|
|
|
|
$num_content_words++; |
482
|
|
|
|
|
|
|
push @pos_sequence,$_[1]; |
483
|
|
|
|
|
|
|
push @parse, "$_[1]<=$_[2]>"; |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
} |
486
|
|
|
|
|
|
|
], |
487
|
|
|
|
|
|
|
[#Rule 18 |
488
|
|
|
|
|
|
|
'CANDIDATE', 3, undef |
489
|
|
|
|
|
|
|
], |
490
|
|
|
|
|
|
|
[#Rule 19 |
491
|
|
|
|
|
|
|
'CANDIDATE', 2, |
492
|
|
|
|
|
|
|
sub |
493
|
|
|
|
|
|
|
#line 111 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
494
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
495
|
|
|
|
|
|
|
], |
496
|
|
|
|
|
|
|
[#Rule 20 |
497
|
|
|
|
|
|
|
'PREP', 1, |
498
|
|
|
|
|
|
|
sub |
499
|
|
|
|
|
|
|
#line 114 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
500
|
|
|
|
|
|
|
{# print STDERR "PREP $_[1]\n"; |
501
|
|
|
|
|
|
|
$node->{"PREP"} = $_[1]; |
502
|
|
|
|
|
|
|
push @pos_sequence, $_[1]; |
503
|
|
|
|
|
|
|
push @parse, $_[1]; |
504
|
|
|
|
|
|
|
} |
505
|
|
|
|
|
|
|
], |
506
|
|
|
|
|
|
|
[#Rule 21 |
507
|
|
|
|
|
|
|
'PREP', 2, |
508
|
|
|
|
|
|
|
sub |
509
|
|
|
|
|
|
|
#line 119 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
510
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
511
|
|
|
|
|
|
|
], |
512
|
|
|
|
|
|
|
[#Rule 22 |
513
|
|
|
|
|
|
|
'DET', 1, |
514
|
|
|
|
|
|
|
sub |
515
|
|
|
|
|
|
|
#line 123 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
516
|
|
|
|
|
|
|
{# print STDERR "DET $_[1]\n"; |
517
|
|
|
|
|
|
|
$node->{"DET"} = $_[1]; |
518
|
|
|
|
|
|
|
push @pos_sequence, $_[1]; |
519
|
|
|
|
|
|
|
push @parse, $_[1]; |
520
|
|
|
|
|
|
|
} |
521
|
|
|
|
|
|
|
], |
522
|
|
|
|
|
|
|
[#Rule 23 |
523
|
|
|
|
|
|
|
'DET', 2, |
524
|
|
|
|
|
|
|
sub |
525
|
|
|
|
|
|
|
#line 128 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
526
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
527
|
|
|
|
|
|
|
], |
528
|
|
|
|
|
|
|
[#Rule 24 |
529
|
|
|
|
|
|
|
'CLOSE', 1, |
530
|
|
|
|
|
|
|
sub |
531
|
|
|
|
|
|
|
#line 131 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
532
|
|
|
|
|
|
|
{# print STDERR "CLOSE_TAG $_[1]\n"; |
533
|
|
|
|
|
|
|
pop @uncomplete; |
534
|
|
|
|
|
|
|
$node->linkToFather(\@uncomplete,$_[1]); |
535
|
|
|
|
|
|
|
$node = $uncomplete[$#uncomplete]; |
536
|
|
|
|
|
|
|
$level--; |
537
|
|
|
|
|
|
|
push @parse, ')'; |
538
|
|
|
|
|
|
|
} |
539
|
|
|
|
|
|
|
], |
540
|
|
|
|
|
|
|
[#Rule 25 |
541
|
|
|
|
|
|
|
'CLOSE', 2, |
542
|
|
|
|
|
|
|
sub |
543
|
|
|
|
|
|
|
#line 138 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
544
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
545
|
|
|
|
|
|
|
], |
546
|
|
|
|
|
|
|
[#Rule 26 |
547
|
|
|
|
|
|
|
'END', 1, |
548
|
|
|
|
|
|
|
sub |
549
|
|
|
|
|
|
|
#line 141 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
550
|
|
|
|
|
|
|
{# print STDERR "END $_[1]\n"; |
551
|
|
|
|
|
|
|
push @parse, $_[1]; |
552
|
|
|
|
|
|
|
$_[1]; |
553
|
|
|
|
|
|
|
} |
554
|
|
|
|
|
|
|
], |
555
|
|
|
|
|
|
|
[#Rule 27 |
556
|
|
|
|
|
|
|
'END', 2, |
557
|
|
|
|
|
|
|
sub |
558
|
|
|
|
|
|
|
#line 145 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
559
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
560
|
|
|
|
|
|
|
], |
561
|
|
|
|
|
|
|
[#Rule 28 |
562
|
|
|
|
|
|
|
'priority', 1, |
563
|
|
|
|
|
|
|
sub |
564
|
|
|
|
|
|
|
#line 147 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
565
|
|
|
|
|
|
|
{# print STDERR "PRIORITY\n"; |
566
|
|
|
|
|
|
|
$priority = $_[1]; |
567
|
|
|
|
|
|
|
} |
568
|
|
|
|
|
|
|
], |
569
|
|
|
|
|
|
|
[#Rule 29 |
570
|
|
|
|
|
|
|
'priority', 2, |
571
|
|
|
|
|
|
|
sub |
572
|
|
|
|
|
|
|
#line 150 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
573
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
574
|
|
|
|
|
|
|
], |
575
|
|
|
|
|
|
|
[#Rule 30 |
576
|
|
|
|
|
|
|
'direction', 1, |
577
|
|
|
|
|
|
|
sub |
578
|
|
|
|
|
|
|
#line 153 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
579
|
|
|
|
|
|
|
{# print STDERR "DIRECTION $_[1]\n"; |
580
|
|
|
|
|
|
|
$direction = $_[1]; |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
], |
583
|
|
|
|
|
|
|
[#Rule 31 |
584
|
|
|
|
|
|
|
'direction', 2, |
585
|
|
|
|
|
|
|
sub |
586
|
|
|
|
|
|
|
#line 156 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
587
|
|
|
|
|
|
|
{ $_[0]->YYErrok } |
588
|
|
|
|
|
|
|
] |
589
|
|
|
|
|
|
|
], |
590
|
|
|
|
|
|
|
@_); |
591
|
|
|
|
|
|
|
bless($self,$class); |
592
|
|
|
|
|
|
|
} |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
#line 159 "lib/Lingua/YaTeA/ParsingPatternParser.yp" |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
sub _Error { |
600
|
|
|
|
|
|
|
exists $_[0]->YYData->{ERRMSG} |
601
|
|
|
|
|
|
|
and do { |
602
|
|
|
|
|
|
|
print $_[0]->YYData->{ERRMSG}; |
603
|
|
|
|
|
|
|
delete $_[0]->YYData->{ERRMSG}; |
604
|
|
|
|
|
|
|
return; |
605
|
|
|
|
|
|
|
}; |
606
|
|
|
|
|
|
|
print "Syntax error.\n"; |
607
|
|
|
|
|
|
|
} |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
sub _Lexer { |
610
|
|
|
|
|
|
|
my($parser)=shift; |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
my $fh = $parser->YYData->{FH}; |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
my $open = '(\()'; |
615
|
|
|
|
|
|
|
my $det = $parser->YYData->{DETERMINERS}; |
616
|
|
|
|
|
|
|
my $prep = $parser->YYData->{PREPOSITIONS}; |
617
|
|
|
|
|
|
|
my $candidates = $parser->YYData->{CANDIDATES}; |
618
|
|
|
|
|
|
|
my $positions = '<=(([MH])||(C[12]))>'; |
619
|
|
|
|
|
|
|
my $close = '\)<=(([MH])||(C[12]))>'; |
620
|
|
|
|
|
|
|
my $end = '(\))\t+'; |
621
|
|
|
|
|
|
|
my $priority = '([0-9]+)\t+'; |
622
|
|
|
|
|
|
|
my $direction = '((LEFT)|(RIGHT))'; |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
$parser->YYData->{INPUT} |
626
|
|
|
|
|
|
|
or $parser->YYData->{INPUT} = <$fh> |
627
|
|
|
|
|
|
|
or return('',undef); |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
$parser->YYData->{INPUT}=~s/^[ \t]*#.*//; |
630
|
|
|
|
|
|
|
$parser->YYData->{INPUT}=~s/^[ \t]*//; |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
for ($parser->YYData->{INPUT}) { |
635
|
|
|
|
|
|
|
s/^$open\s*// and return ('OPEN_TAG', $1); |
636
|
|
|
|
|
|
|
s/^$candidates\s*// and return('CANDIDATE_TAG', $1); |
637
|
|
|
|
|
|
|
s/^$prep// and return('PREP_TAG', $1); |
638
|
|
|
|
|
|
|
s/^$det// and return('DET_TAG', $1); |
639
|
|
|
|
|
|
|
s/^$positions\s*// and return('POSITION_TAG', $1); |
640
|
|
|
|
|
|
|
s/^$close// and return('CLOSE_TAG', $1); |
641
|
|
|
|
|
|
|
s/^$end// and return('END_TAG', $1); |
642
|
|
|
|
|
|
|
s/^$priority// and return('PRIORITY_TAG', $1); |
643
|
|
|
|
|
|
|
s/^$direction// and return('DIRECTION_TAG', $1); |
644
|
|
|
|
|
|
|
s/^(.)//s and return($1,$1); |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
} |
647
|
|
|
|
|
|
|
} |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
# sub Run { |
650
|
|
|
|
|
|
|
# my($self)=shift; |
651
|
|
|
|
|
|
|
# $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error ); |
652
|
|
|
|
|
|
|
# } |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
# my($parsingpattern)=new ParsingPatternParser; |
655
|
|
|
|
|
|
|
# $parsingpattern->Run; |
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
__END__ |