line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::WordFromCorpus; |
2
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
82
|
|
3
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
69
|
|
4
|
3
|
|
|
3
|
|
16
|
use Lingua::YaTeA::WordOccurrence; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
19
|
|
5
|
|
|
|
|
|
|
# use UNIVERSAL; |
6
|
|
|
|
|
|
|
# use Scalar::Util qw(blessed); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Lingua::YaTeA::WordOccurrence); |
9
|
|
|
|
|
|
|
our $counter = 0; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
598
|
|
|
598
|
1
|
1172
|
my ($class,$form,$lexicon,$sentences) = @_; |
16
|
598
|
|
|
|
|
1563
|
my $this = $class->SUPER::new($form); |
17
|
598
|
|
|
|
|
920
|
bless ($this,$class); |
18
|
598
|
|
|
|
|
1003
|
$this->{ID} = $counter; |
19
|
598
|
|
|
|
|
1067
|
$this->{LEX_ITEM} = $this->setLexItem($form,$lexicon); |
20
|
598
|
|
|
|
|
1425
|
$this->{SENTENCE} = $sentences->getCurrent; |
21
|
598
|
|
|
|
|
1015
|
$this->{START_CHAR} = $Lingua::YaTeA::Sentence::start_char; |
22
|
598
|
|
|
|
|
1257
|
return $this; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub setLexItem |
27
|
|
|
|
|
|
|
{ |
28
|
598
|
|
|
598
|
1
|
1012
|
my ($this,$form,$lexicon) = @_; |
29
|
598
|
|
|
|
|
1367
|
return $lexicon->addOccurrence($form); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub getID |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
0
|
1
|
0
|
my ($this) = @_; |
36
|
0
|
|
|
|
|
0
|
return $this->{ID}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub getSentence |
41
|
|
|
|
|
|
|
{ |
42
|
122
|
|
|
122
|
1
|
237
|
my ($this) = @_; |
43
|
122
|
|
|
|
|
280
|
return $this->{SENTENCE}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub getDocument |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
0
|
1
|
0
|
my ($this) = @_; |
49
|
0
|
|
|
|
|
0
|
return $this->getSentence->getDocument; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub getSentenceID |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
0
|
1
|
0
|
my ($this) = @_; |
55
|
0
|
|
|
|
|
0
|
return $this->getSentence->getID; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub getDocumentID |
59
|
|
|
|
|
|
|
{ |
60
|
0
|
|
|
0
|
1
|
0
|
my ($this) = @_; |
61
|
0
|
|
|
|
|
0
|
return $this->getSentence->getDocument->getID; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub getStartChar |
65
|
|
|
|
|
|
|
{ |
66
|
244
|
|
|
244
|
1
|
408
|
my ($this) = @_; |
67
|
244
|
|
|
|
|
515
|
return $this->{START_CHAR}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub getLexItem |
71
|
|
|
|
|
|
|
{ |
72
|
7725
|
|
|
7725
|
1
|
11779
|
my ($this) = @_; |
73
|
7725
|
|
|
|
|
19686
|
return $this->{LEX_ITEM}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub isSentenceBoundary |
77
|
|
|
|
|
|
|
{ |
78
|
1180
|
|
|
1180
|
1
|
2220
|
my ($this,$sentence_boundary) = @_; |
79
|
|
|
|
|
|
|
|
80
|
1180
|
100
|
|
|
|
2068
|
if ($this->getLexItem->getPOS eq $sentence_boundary) |
81
|
|
|
|
|
|
|
{ |
82
|
36
|
|
|
|
|
129
|
return 1; |
83
|
|
|
|
|
|
|
} |
84
|
1144
|
|
|
|
|
3589
|
return 0; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub isDocumentBoundary |
88
|
|
|
|
|
|
|
{ |
89
|
1144
|
|
|
1144
|
1
|
2158
|
my ($this,$document_boundary) = @_; |
90
|
|
|
|
|
|
|
|
91
|
1144
|
50
|
|
|
|
1891
|
if ($this->getLexItem->getPOS eq $document_boundary) |
92
|
|
|
|
|
|
|
{ |
93
|
0
|
|
|
|
|
0
|
return 1; |
94
|
|
|
|
|
|
|
} |
95
|
1144
|
|
|
|
|
3279
|
return 0; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub updateSentence |
101
|
|
|
|
|
|
|
{ |
102
|
0
|
|
|
0
|
1
|
0
|
my ($this,$sentences) = @_; |
103
|
0
|
|
|
|
|
0
|
$this->{SENTENCE} = $sentences->getCurrent; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub updateStartChar |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
0
|
1
|
0
|
my ($this) = @_; |
109
|
0
|
|
|
|
|
0
|
$this->{START_CHAR} = $Lingua::YaTeA::Sentence::start_char; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub isChunkingFrontier |
113
|
|
|
|
|
|
|
{ |
114
|
568
|
|
|
568
|
1
|
992
|
my ($this,$chunking_data) = @_; |
115
|
568
|
|
|
|
|
1150
|
my @types = ("POS", "LF", "IF"); |
116
|
568
|
|
|
|
|
774
|
my $type; |
117
|
568
|
|
|
|
|
999
|
foreach $type (@types) |
118
|
|
|
|
|
|
|
{ |
119
|
|
|
|
|
|
|
# word is a chunking frontier |
120
|
1208
|
100
|
|
|
|
2140
|
if ($chunking_data->existData("ChunkingFrontiers",$type,$this->getLexItem->{$type}) == 1) |
121
|
|
|
|
|
|
|
{ |
122
|
|
|
|
|
|
|
# word is not a chunking exception : end |
123
|
248
|
100
|
|
|
|
530
|
if (! $this->isChunkingException($chunking_data) ) |
124
|
|
|
|
|
|
|
{ |
125
|
|
|
|
|
|
|
|
126
|
214
|
|
|
|
|
662
|
return 1; |
127
|
|
|
|
|
|
|
} |
128
|
34
|
|
|
|
|
110
|
return 0; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
} |
131
|
320
|
|
|
|
|
959
|
return 0; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub isChunkingException |
135
|
|
|
|
|
|
|
{ |
136
|
248
|
|
|
248
|
1
|
427
|
my ($this,$chunking_data) = @_; |
137
|
248
|
|
|
|
|
503
|
my @types = ("POS", "LF", "IF"); |
138
|
248
|
|
|
|
|
393
|
my $type; |
139
|
248
|
|
|
|
|
418
|
foreach $type (@types) |
140
|
|
|
|
|
|
|
{ |
141
|
744
|
100
|
|
|
|
1354
|
if ($chunking_data->existData("ChunkingExceptions",$type,$this->getLexItem->{$type}) == 1) |
142
|
|
|
|
|
|
|
{ |
143
|
34
|
|
|
|
|
118
|
return 1; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
} |
146
|
214
|
|
|
|
|
573
|
return 0; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub isCleaningFrontier |
150
|
|
|
|
|
|
|
{ |
151
|
314
|
|
|
314
|
1
|
590
|
my ($this,$chunking_data) = @_; |
152
|
314
|
|
|
|
|
738
|
my @types = ("POS", "LF", "IF"); |
153
|
314
|
|
|
|
|
485
|
my $type; |
154
|
314
|
|
|
|
|
515
|
foreach $type (@types) |
155
|
|
|
|
|
|
|
{ |
156
|
446
|
100
|
|
|
|
866
|
if ($chunking_data->existData("CleaningFrontiers",$type,$this->getLexItem->{$type}) == 1) |
157
|
|
|
|
|
|
|
{ |
158
|
248
|
50
|
|
|
|
551
|
if (! $this->isCleaningException($chunking_data)) |
159
|
|
|
|
|
|
|
{ |
160
|
248
|
|
|
|
|
806
|
return 1; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
} |
164
|
66
|
|
|
|
|
215
|
return 0; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub isCleaningException |
168
|
|
|
|
|
|
|
{ |
169
|
248
|
|
|
248
|
1
|
401
|
my ($this,$chunking_data) = @_; |
170
|
248
|
|
|
|
|
545
|
my @types = ("POS", "LF", "IF"); |
171
|
248
|
|
|
|
|
363
|
my $type; |
172
|
248
|
|
|
|
|
411
|
foreach $type (@types) |
173
|
|
|
|
|
|
|
{ |
174
|
744
|
50
|
|
|
|
1367
|
if ($chunking_data->existData("CleaningExceptions",$type,$this->getLexItem->{$type}) == 1) |
175
|
|
|
|
|
|
|
{ |
176
|
0
|
|
|
|
|
0
|
return 1; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
} |
179
|
248
|
|
|
|
|
637
|
return 0; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub isCompulsory |
183
|
|
|
|
|
|
|
{ |
184
|
145
|
|
|
145
|
1
|
320
|
my ($this,$compulsory) = @_; |
185
|
|
|
|
|
|
|
# my $compuslory = $options->getCompulsory; |
186
|
|
|
|
|
|
|
|
187
|
145
|
100
|
|
|
|
268
|
if # ( |
188
|
|
|
|
|
|
|
# ((blessed($this)) && ($this->isa("Lingua::YaTeA::TestifiedTermMark"))) |
189
|
|
|
|
|
|
|
# || |
190
|
|
|
|
|
|
|
($this->getLexItem->getPOS =~ /$compulsory/) |
191
|
|
|
|
|
|
|
# ) |
192
|
|
|
|
|
|
|
{ |
193
|
120
|
|
|
|
|
525
|
return 1; |
194
|
|
|
|
|
|
|
} |
195
|
25
|
|
|
|
|
127
|
return 0; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub getPOS |
199
|
|
|
|
|
|
|
{ |
200
|
286
|
|
|
286
|
1
|
486
|
my ($this) = @_; |
201
|
286
|
|
|
|
|
502
|
return $this->getLexItem->getPOS; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub isEndTrigger |
205
|
|
|
|
|
|
|
{ |
206
|
126
|
|
|
126
|
1
|
223
|
my ($this,$end_trigger_set) = @_; |
207
|
126
|
|
|
|
|
310
|
return $end_trigger_set->findTrigger($this); |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub isStartTrigger |
211
|
|
|
|
|
|
|
{ |
212
|
122
|
|
|
122
|
1
|
213
|
my ($this,$start_trigger_set) = @_; |
213
|
122
|
|
|
|
|
334
|
return $start_trigger_set->findTrigger($this); |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub getIF |
218
|
|
|
|
|
|
|
{ |
219
|
0
|
|
|
0
|
1
|
|
my ($this) = @_; |
220
|
0
|
|
|
|
|
|
return $this->getLexItem->getIF; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
sub getLF |
224
|
|
|
|
|
|
|
{ |
225
|
0
|
|
|
0
|
1
|
|
my ($this) = @_; |
226
|
0
|
|
|
|
|
|
return $this->getLexItem->getLF; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
1; |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
__END__ |