line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::ForbiddenStructureStartOrEnd; |
2
|
5
|
|
|
5
|
|
33
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
138
|
|
3
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
153
|
|
4
|
5
|
|
|
5
|
|
43
|
use Lingua::YaTeA::ForbiddenStructure; |
|
5
|
|
|
|
|
20
|
|
|
5
|
|
|
|
|
64
|
|
5
|
5
|
|
|
5
|
|
2018
|
use Lingua::YaTeA::LinguisticItem; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
58
|
|
6
|
5
|
|
|
5
|
|
2017
|
use Lingua::YaTeA::TriggerSet; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
94
|
|
7
|
5
|
|
|
5
|
|
140
|
use UNIVERSAL; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
27
|
|
8
|
5
|
|
|
5
|
|
134
|
use Scalar::Util qw(blessed); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
4733
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Lingua::YaTeA::ForbiddenStructure); |
12
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new |
15
|
|
|
|
|
|
|
{ |
16
|
28
|
|
|
28
|
1
|
98
|
my ($class,$infos_a,$triggers) = @_; |
17
|
28
|
|
|
|
|
85
|
my ($form,$items_a) = $class->parse($infos_a->[0]); |
18
|
28
|
|
|
|
|
108
|
my $this = $class->SUPER::new($form); |
19
|
28
|
|
|
|
|
58
|
bless ($this,$class); |
20
|
28
|
|
|
|
|
62
|
$this->{POSITION} = $infos_a->[1]; |
21
|
28
|
|
|
|
|
55
|
$this->{ITEMS} = $items_a; |
22
|
28
|
|
|
|
|
87
|
$triggers->addTrigger($this); |
23
|
28
|
|
|
|
|
74
|
return $this; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub getFirstItem |
27
|
|
|
|
|
|
|
{ |
28
|
28
|
|
|
28
|
1
|
51
|
my ($this) = @_; |
29
|
28
|
100
|
|
|
|
60
|
if($this->isStart) |
30
|
|
|
|
|
|
|
{ |
31
|
12
|
|
|
|
|
32
|
return $this->getItemSet->[0]; |
32
|
|
|
|
|
|
|
} |
33
|
16
|
50
|
|
|
|
41
|
if($this->isEnd) |
34
|
|
|
|
|
|
|
{ |
35
|
16
|
|
|
|
|
44
|
return $this->getItemSet->[$#{$this->getItemSet}]; |
|
16
|
|
|
|
|
35
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub getItemSet |
41
|
|
|
|
|
|
|
{ |
42
|
140
|
|
|
140
|
1
|
232
|
my ($this) = @_; |
43
|
140
|
|
|
|
|
429
|
return $this->{ITEMS}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub parse |
47
|
|
|
|
|
|
|
{ |
48
|
28
|
|
|
28
|
1
|
66
|
my ($class,$string) = @_; |
49
|
28
|
|
|
|
|
84
|
my @elements = split / /, $string; |
50
|
28
|
|
|
|
|
95
|
my $element; |
51
|
|
|
|
|
|
|
my $i_form; |
52
|
28
|
|
|
|
|
0
|
my $fs_form; |
53
|
28
|
|
|
|
|
0
|
my $type; |
54
|
28
|
|
|
|
|
46
|
my $rank = 0; |
55
|
28
|
|
|
|
|
41
|
my @items; |
56
|
|
|
|
|
|
|
|
57
|
28
|
|
|
|
|
56
|
foreach $element (@elements){ |
58
|
40
|
|
|
|
|
140
|
$element =~ /^([^\\]+)\\(.+)$/; |
59
|
40
|
|
|
|
|
90
|
$i_form = $1; |
60
|
40
|
|
|
|
|
74
|
$type =$2; |
61
|
40
|
|
|
|
|
135
|
push @items, Lingua::YaTeA::LinguisticItem->new($type,$i_form); |
62
|
40
|
100
|
|
|
|
99
|
if($rank == 0){ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
40
|
|
|
|
|
79
|
$fs_form .= $i_form . " "; |
66
|
40
|
|
|
|
|
70
|
$rank++; |
67
|
|
|
|
|
|
|
} |
68
|
28
|
|
|
|
|
95
|
$fs_form =~ s/ $//; |
69
|
28
|
|
|
|
|
96
|
return ($fs_form,\@items); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub getItem |
75
|
|
|
|
|
|
|
{ |
76
|
96
|
|
|
96
|
1
|
175
|
my ($this,$index) = @_; |
77
|
96
|
|
|
|
|
183
|
return $this->getItemSet->[$index]; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub isStart |
81
|
|
|
|
|
|
|
{ |
82
|
78
|
|
|
78
|
1
|
141
|
my ($this) = @_; |
83
|
78
|
100
|
|
|
|
166
|
if($this->getPosition eq "START") |
84
|
|
|
|
|
|
|
{ |
85
|
58
|
|
|
|
|
164
|
return 1; |
86
|
|
|
|
|
|
|
} |
87
|
20
|
|
|
|
|
72
|
return 0; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub isEnd |
91
|
|
|
|
|
|
|
{ |
92
|
20
|
|
|
20
|
1
|
41
|
my ($this) = @_; |
93
|
20
|
50
|
|
|
|
48
|
if($this->getPosition eq "END") |
94
|
|
|
|
|
|
|
{ |
95
|
20
|
|
|
|
|
72
|
return 1; |
96
|
|
|
|
|
|
|
} |
97
|
0
|
|
|
|
|
0
|
return 0; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub getPosition |
101
|
|
|
|
|
|
|
{ |
102
|
98
|
|
|
98
|
1
|
168
|
my ($this) = @_; |
103
|
98
|
|
|
|
|
286
|
return $this->{POSITION}; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub apply |
111
|
|
|
|
|
|
|
{ |
112
|
50
|
|
|
50
|
1
|
95
|
my ($this,$words_a) = @_; |
113
|
50
|
|
|
|
|
88
|
my $i; |
114
|
|
|
|
|
|
|
my $j; |
115
|
|
|
|
|
|
|
|
116
|
50
|
|
|
|
|
80
|
$i = 0; |
117
|
50
|
|
|
|
|
63
|
$j = 0; |
118
|
50
|
|
|
|
|
77
|
my $to_delete; |
119
|
|
|
|
|
|
|
|
120
|
50
|
100
|
|
|
|
98
|
if($this->isStart){ |
121
|
46
|
|
|
|
|
106
|
while ($j < $this->getLength) |
122
|
|
|
|
|
|
|
{ |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# warn "ref: " . ref($words_a->[$i]) . "\n"; |
125
|
92
|
50
|
33
|
|
|
502
|
if ((blessed($words_a->[$i])) && ($words_a->[$i]->isa('Lingua::YaTeA::TestifiedTermMark'))) |
126
|
|
|
|
|
|
|
{ |
127
|
0
|
|
|
|
|
0
|
return; |
128
|
|
|
|
|
|
|
#return $to_delete; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
else |
131
|
|
|
|
|
|
|
{ |
132
|
92
|
100
|
33
|
|
|
730
|
if |
|
|
|
33
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
133
|
|
|
|
|
|
|
( |
134
|
|
|
|
|
|
|
(((blessed($words_a->[$i])) && ($words_a->[$i]->isa('Lingua::YaTeA::ForbiddenStructureStartOrEnd')))) |
135
|
|
|
|
|
|
|
|| |
136
|
|
|
|
|
|
|
( |
137
|
|
|
|
|
|
|
(((blessed($words_a->[$i])) && ($words_a->[$i]->isa('Lingua::YaTeA::WordFromCorpus')))) |
138
|
|
|
|
|
|
|
&& |
139
|
|
|
|
|
|
|
($this->getItem($j)->matchesWord($words_a->[$i])) |
140
|
|
|
|
|
|
|
) |
141
|
|
|
|
|
|
|
) |
142
|
|
|
|
|
|
|
{ |
143
|
46
|
|
|
|
|
78
|
$i++; |
144
|
46
|
|
|
|
|
67
|
$j++; |
145
|
46
|
|
|
|
|
142
|
$to_delete++; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
else |
148
|
|
|
|
|
|
|
{ |
149
|
46
|
|
|
|
|
136
|
return; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
} |
154
|
4
|
50
|
|
|
|
15
|
if($this->isEnd) |
155
|
|
|
|
|
|
|
{ |
156
|
4
|
|
|
|
|
11
|
$i = $#$words_a; |
157
|
4
|
|
|
|
|
16
|
$j = $this->getLength -1; |
158
|
4
|
|
|
|
|
15
|
while ($j >= 0) |
159
|
|
|
|
|
|
|
{ |
160
|
|
|
|
|
|
|
|
161
|
4
|
50
|
33
|
|
|
42
|
if((blessed($words_a->[$i])) && ($words_a->[$i]->isa('Lingua::YaTeA::TestifiedTermMark'))) |
162
|
|
|
|
|
|
|
{ |
163
|
0
|
|
|
|
|
0
|
return; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
else |
166
|
|
|
|
|
|
|
{ |
167
|
|
|
|
|
|
|
|
168
|
4
|
50
|
33
|
|
|
107
|
if |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
169
|
|
|
|
|
|
|
( |
170
|
|
|
|
|
|
|
(((blessed($words_a->[$i])) && ($words_a->[$i]->isa('Lingua::YaTeA::ForbiddenStructureStartOrEnd')))) |
171
|
|
|
|
|
|
|
|| |
172
|
|
|
|
|
|
|
( |
173
|
|
|
|
|
|
|
(((blessed($words_a->[$i])) && ($words_a->[$i]->isa('Lingua::YaTeA::WordFromCorpus')))) |
174
|
|
|
|
|
|
|
&& |
175
|
|
|
|
|
|
|
($this->getItem($j)->matchesWord($words_a->[$i])) |
176
|
|
|
|
|
|
|
) |
177
|
|
|
|
|
|
|
) |
178
|
|
|
|
|
|
|
{ |
179
|
4
|
|
|
|
|
13
|
$i--; |
180
|
4
|
|
|
|
|
9
|
$j--; |
181
|
4
|
|
|
|
|
16
|
$to_delete++; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
else |
184
|
|
|
|
|
|
|
{ |
185
|
0
|
|
|
|
|
0
|
return; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
} |
190
|
4
|
|
|
|
|
12
|
return $to_delete; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub print |
194
|
|
|
|
|
|
|
{ |
195
|
0
|
|
|
0
|
1
|
|
my ($this) = @_; |
196
|
0
|
|
|
|
|
|
print $this->{FORM} . "\n"; |
197
|
0
|
|
|
|
|
|
print $this->{POSITION} . "\n"; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
1; |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
__END__ |