line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::ForbiddenStructureStartOrEnd; |
2
|
5
|
|
|
5
|
|
26
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
115
|
|
3
|
5
|
|
|
5
|
|
21
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
121
|
|
4
|
5
|
|
|
5
|
|
30
|
use Lingua::YaTeA::ForbiddenStructure; |
|
5
|
|
|
|
|
40
|
|
|
5
|
|
|
|
|
46
|
|
5
|
5
|
|
|
5
|
|
1704
|
use Lingua::YaTeA::LinguisticItem; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
48
|
|
6
|
5
|
|
|
5
|
|
1639
|
use Lingua::YaTeA::TriggerSet; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
72
|
|
7
|
5
|
|
|
5
|
|
113
|
use UNIVERSAL; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
19
|
|
8
|
5
|
|
|
5
|
|
107
|
use Scalar::Util qw(blessed); |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
3879
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Lingua::YaTeA::ForbiddenStructure); |
12
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new |
15
|
|
|
|
|
|
|
{ |
16
|
28
|
|
|
28
|
1
|
51
|
my ($class,$infos_a,$triggers) = @_; |
17
|
28
|
|
|
|
|
65
|
my ($form,$items_a) = $class->parse($infos_a->[0]); |
18
|
28
|
|
|
|
|
88
|
my $this = $class->SUPER::new($form); |
19
|
28
|
|
|
|
|
44
|
bless ($this,$class); |
20
|
28
|
|
|
|
|
44
|
$this->{POSITION} = $infos_a->[1]; |
21
|
28
|
|
|
|
|
39
|
$this->{ITEMS} = $items_a; |
22
|
28
|
|
|
|
|
95
|
$triggers->addTrigger($this); |
23
|
28
|
|
|
|
|
63
|
return $this; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub getFirstItem |
27
|
|
|
|
|
|
|
{ |
28
|
28
|
|
|
28
|
1
|
43
|
my ($this) = @_; |
29
|
28
|
100
|
|
|
|
47
|
if($this->isStart) |
30
|
|
|
|
|
|
|
{ |
31
|
12
|
|
|
|
|
23
|
return $this->getItemSet->[0]; |
32
|
|
|
|
|
|
|
} |
33
|
16
|
50
|
|
|
|
31
|
if($this->isEnd) |
34
|
|
|
|
|
|
|
{ |
35
|
16
|
|
|
|
|
30
|
return $this->getItemSet->[$#{$this->getItemSet}]; |
|
16
|
|
|
|
|
32
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub getItemSet |
41
|
|
|
|
|
|
|
{ |
42
|
140
|
|
|
140
|
1
|
181
|
my ($this) = @_; |
43
|
140
|
|
|
|
|
358
|
return $this->{ITEMS}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub parse |
47
|
|
|
|
|
|
|
{ |
48
|
28
|
|
|
28
|
1
|
41
|
my ($class,$string) = @_; |
49
|
28
|
|
|
|
|
59
|
my @elements = split / /, $string; |
50
|
28
|
|
|
|
|
79
|
my $element; |
51
|
|
|
|
|
|
|
my $i_form; |
52
|
28
|
|
|
|
|
0
|
my $fs_form; |
53
|
28
|
|
|
|
|
0
|
my $type; |
54
|
28
|
|
|
|
|
41
|
my $rank = 0; |
55
|
28
|
|
|
|
|
42
|
my @items; |
56
|
|
|
|
|
|
|
|
57
|
28
|
|
|
|
|
43
|
foreach $element (@elements){ |
58
|
40
|
|
|
|
|
117
|
$element =~ /^([^\\]+)\\(.+)$/; |
59
|
40
|
|
|
|
|
79
|
$i_form = $1; |
60
|
40
|
|
|
|
|
62
|
$type =$2; |
61
|
40
|
|
|
|
|
102
|
push @items, Lingua::YaTeA::LinguisticItem->new($type,$i_form); |
62
|
40
|
100
|
|
|
|
84
|
if($rank == 0){ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
40
|
|
|
|
|
61
|
$fs_form .= $i_form . " "; |
66
|
40
|
|
|
|
|
52
|
$rank++; |
67
|
|
|
|
|
|
|
} |
68
|
28
|
|
|
|
|
79
|
$fs_form =~ s/ $//; |
69
|
28
|
|
|
|
|
76
|
return ($fs_form,\@items); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub getItem |
75
|
|
|
|
|
|
|
{ |
76
|
96
|
|
|
96
|
1
|
145
|
my ($this,$index) = @_; |
77
|
96
|
|
|
|
|
154
|
return $this->getItemSet->[$index]; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub isStart |
81
|
|
|
|
|
|
|
{ |
82
|
78
|
|
|
78
|
1
|
103
|
my ($this) = @_; |
83
|
78
|
100
|
|
|
|
137
|
if($this->getPosition eq "START") |
84
|
|
|
|
|
|
|
{ |
85
|
58
|
|
|
|
|
130
|
return 1; |
86
|
|
|
|
|
|
|
} |
87
|
20
|
|
|
|
|
54
|
return 0; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub isEnd |
91
|
|
|
|
|
|
|
{ |
92
|
20
|
|
|
20
|
1
|
36
|
my ($this) = @_; |
93
|
20
|
50
|
|
|
|
36
|
if($this->getPosition eq "END") |
94
|
|
|
|
|
|
|
{ |
95
|
20
|
|
|
|
|
57
|
return 1; |
96
|
|
|
|
|
|
|
} |
97
|
0
|
|
|
|
|
0
|
return 0; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub getPosition |
101
|
|
|
|
|
|
|
{ |
102
|
98
|
|
|
98
|
1
|
188
|
my ($this) = @_; |
103
|
98
|
|
|
|
|
227
|
return $this->{POSITION}; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub apply |
111
|
|
|
|
|
|
|
{ |
112
|
50
|
|
|
50
|
1
|
80
|
my ($this,$words_a) = @_; |
113
|
50
|
|
|
|
|
64
|
my $i; |
114
|
|
|
|
|
|
|
my $j; |
115
|
|
|
|
|
|
|
|
116
|
50
|
|
|
|
|
67
|
$i = 0; |
117
|
50
|
|
|
|
|
55
|
$j = 0; |
118
|
50
|
|
|
|
|
59
|
my $to_delete; |
119
|
|
|
|
|
|
|
|
120
|
50
|
100
|
|
|
|
93
|
if($this->isStart){ |
121
|
46
|
|
|
|
|
92
|
while ($j < $this->getLength) |
122
|
|
|
|
|
|
|
{ |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# warn "ref: " . ref($words_a->[$i]) . "\n"; |
125
|
92
|
50
|
33
|
|
|
428
|
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
|
|
|
631
|
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
|
|
|
|
|
66
|
$i++; |
144
|
46
|
|
|
|
|
55
|
$j++; |
145
|
46
|
|
|
|
|
134
|
$to_delete++; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
else |
148
|
|
|
|
|
|
|
{ |
149
|
46
|
|
|
|
|
116
|
return; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
} |
154
|
4
|
50
|
|
|
|
11
|
if($this->isEnd) |
155
|
|
|
|
|
|
|
{ |
156
|
4
|
|
|
|
|
10
|
$i = $#$words_a; |
157
|
4
|
|
|
|
|
11
|
$j = $this->getLength -1; |
158
|
4
|
|
|
|
|
10
|
while ($j >= 0) |
159
|
|
|
|
|
|
|
{ |
160
|
|
|
|
|
|
|
|
161
|
4
|
50
|
33
|
|
|
34
|
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
|
|
|
85
|
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
|
|
|
|
|
11
|
$i--; |
180
|
4
|
|
|
|
|
4
|
$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__ |