line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::WordFromCorpus; |
2
|
3
|
|
|
3
|
|
21
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
84
|
|
3
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
69
|
|
4
|
3
|
|
|
3
|
|
15
|
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
|
1074
|
my ($class,$form,$lexicon,$sentences) = @_; |
16
|
598
|
|
|
|
|
1577
|
my $this = $class->SUPER::new($form); |
17
|
598
|
|
|
|
|
1003
|
bless ($this,$class); |
18
|
598
|
|
|
|
|
1052
|
$this->{ID} = $counter; |
19
|
598
|
|
|
|
|
990
|
$this->{LEX_ITEM} = $this->setLexItem($form,$lexicon); |
20
|
598
|
|
|
|
|
1491
|
$this->{SENTENCE} = $sentences->getCurrent; |
21
|
598
|
|
|
|
|
975
|
$this->{START_CHAR} = $Lingua::YaTeA::Sentence::start_char; |
22
|
598
|
|
|
|
|
1294
|
return $this; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub setLexItem |
27
|
|
|
|
|
|
|
{ |
28
|
598
|
|
|
598
|
1
|
1053
|
my ($this,$form,$lexicon) = @_; |
29
|
598
|
|
|
|
|
1330
|
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
|
231
|
my ($this) = @_; |
43
|
122
|
|
|
|
|
262
|
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
|
369
|
my ($this) = @_; |
67
|
244
|
|
|
|
|
521
|
return $this->{START_CHAR}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub getLexItem |
71
|
|
|
|
|
|
|
{ |
72
|
7725
|
|
|
7725
|
1
|
11350
|
my ($this) = @_; |
73
|
7725
|
|
|
|
|
18311
|
return $this->{LEX_ITEM}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub isSentenceBoundary |
77
|
|
|
|
|
|
|
{ |
78
|
1180
|
|
|
1180
|
1
|
2081
|
my ($this,$sentence_boundary) = @_; |
79
|
|
|
|
|
|
|
|
80
|
1180
|
100
|
|
|
|
1988
|
if ($this->getLexItem->getPOS eq $sentence_boundary) |
81
|
|
|
|
|
|
|
{ |
82
|
36
|
|
|
|
|
129
|
return 1; |
83
|
|
|
|
|
|
|
} |
84
|
1144
|
|
|
|
|
3528
|
return 0; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub isDocumentBoundary |
88
|
|
|
|
|
|
|
{ |
89
|
1144
|
|
|
1144
|
1
|
2010
|
my ($this,$document_boundary) = @_; |
90
|
|
|
|
|
|
|
|
91
|
1144
|
50
|
|
|
|
1893
|
if ($this->getLexItem->getPOS eq $document_boundary) |
92
|
|
|
|
|
|
|
{ |
93
|
0
|
|
|
|
|
0
|
return 1; |
94
|
|
|
|
|
|
|
} |
95
|
1144
|
|
|
|
|
3128
|
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
|
948
|
my ($this,$chunking_data) = @_; |
115
|
568
|
|
|
|
|
1057
|
my @types = ("POS", "LF", "IF"); |
116
|
568
|
|
|
|
|
742
|
my $type; |
117
|
568
|
|
|
|
|
1022
|
foreach $type (@types) |
118
|
|
|
|
|
|
|
{ |
119
|
|
|
|
|
|
|
# word is a chunking frontier |
120
|
1208
|
100
|
|
|
|
2094
|
if ($chunking_data->existData("ChunkingFrontiers",$type,$this->getLexItem->{$type}) == 1) |
121
|
|
|
|
|
|
|
{ |
122
|
|
|
|
|
|
|
# word is not a chunking exception : end |
123
|
248
|
100
|
|
|
|
543
|
if (! $this->isChunkingException($chunking_data) ) |
124
|
|
|
|
|
|
|
{ |
125
|
|
|
|
|
|
|
|
126
|
214
|
|
|
|
|
639
|
return 1; |
127
|
|
|
|
|
|
|
} |
128
|
34
|
|
|
|
|
103
|
return 0; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
} |
131
|
320
|
|
|
|
|
871
|
return 0; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub isChunkingException |
135
|
|
|
|
|
|
|
{ |
136
|
248
|
|
|
248
|
1
|
398
|
my ($this,$chunking_data) = @_; |
137
|
248
|
|
|
|
|
497
|
my @types = ("POS", "LF", "IF"); |
138
|
248
|
|
|
|
|
358
|
my $type; |
139
|
248
|
|
|
|
|
414
|
foreach $type (@types) |
140
|
|
|
|
|
|
|
{ |
141
|
744
|
100
|
|
|
|
1299
|
if ($chunking_data->existData("ChunkingExceptions",$type,$this->getLexItem->{$type}) == 1) |
142
|
|
|
|
|
|
|
{ |
143
|
34
|
|
|
|
|
92
|
return 1; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
} |
146
|
214
|
|
|
|
|
519
|
return 0; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub isCleaningFrontier |
150
|
|
|
|
|
|
|
{ |
151
|
314
|
|
|
314
|
1
|
543
|
my ($this,$chunking_data) = @_; |
152
|
314
|
|
|
|
|
645
|
my @types = ("POS", "LF", "IF"); |
153
|
314
|
|
|
|
|
454
|
my $type; |
154
|
314
|
|
|
|
|
519
|
foreach $type (@types) |
155
|
|
|
|
|
|
|
{ |
156
|
446
|
100
|
|
|
|
873
|
if ($chunking_data->existData("CleaningFrontiers",$type,$this->getLexItem->{$type}) == 1) |
157
|
|
|
|
|
|
|
{ |
158
|
248
|
50
|
|
|
|
498
|
if (! $this->isCleaningException($chunking_data)) |
159
|
|
|
|
|
|
|
{ |
160
|
248
|
|
|
|
|
773
|
return 1; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
} |
164
|
66
|
|
|
|
|
186
|
return 0; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub isCleaningException |
168
|
|
|
|
|
|
|
{ |
169
|
248
|
|
|
248
|
1
|
430
|
my ($this,$chunking_data) = @_; |
170
|
248
|
|
|
|
|
457
|
my @types = ("POS", "LF", "IF"); |
171
|
248
|
|
|
|
|
375
|
my $type; |
172
|
248
|
|
|
|
|
393
|
foreach $type (@types) |
173
|
|
|
|
|
|
|
{ |
174
|
744
|
50
|
|
|
|
1227
|
if ($chunking_data->existData("CleaningExceptions",$type,$this->getLexItem->{$type}) == 1) |
175
|
|
|
|
|
|
|
{ |
176
|
0
|
|
|
|
|
0
|
return 1; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
} |
179
|
248
|
|
|
|
|
559
|
return 0; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub isCompulsory |
183
|
|
|
|
|
|
|
{ |
184
|
145
|
|
|
145
|
1
|
293
|
my ($this,$compulsory) = @_; |
185
|
|
|
|
|
|
|
# my $compuslory = $options->getCompulsory; |
186
|
|
|
|
|
|
|
|
187
|
145
|
100
|
|
|
|
254
|
if # ( |
188
|
|
|
|
|
|
|
# ((blessed($this)) && ($this->isa("Lingua::YaTeA::TestifiedTermMark"))) |
189
|
|
|
|
|
|
|
# || |
190
|
|
|
|
|
|
|
($this->getLexItem->getPOS =~ /$compulsory/) |
191
|
|
|
|
|
|
|
# ) |
192
|
|
|
|
|
|
|
{ |
193
|
120
|
|
|
|
|
533
|
return 1; |
194
|
|
|
|
|
|
|
} |
195
|
25
|
|
|
|
|
112
|
return 0; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub getPOS |
199
|
|
|
|
|
|
|
{ |
200
|
286
|
|
|
286
|
1
|
473
|
my ($this) = @_; |
201
|
286
|
|
|
|
|
490
|
return $this->getLexItem->getPOS; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub isEndTrigger |
205
|
|
|
|
|
|
|
{ |
206
|
126
|
|
|
126
|
1
|
200
|
my ($this,$end_trigger_set) = @_; |
207
|
126
|
|
|
|
|
313
|
return $end_trigger_set->findTrigger($this); |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub isStartTrigger |
211
|
|
|
|
|
|
|
{ |
212
|
122
|
|
|
122
|
1
|
200
|
my ($this,$start_trigger_set) = @_; |
213
|
122
|
|
|
|
|
307
|
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__ |