| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Lingua::YaTeA::Occurrence; |
|
2
|
5
|
|
|
5
|
|
27
|
use strict; |
|
|
5
|
|
|
|
|
7
|
|
|
|
5
|
|
|
|
|
111
|
|
|
3
|
5
|
|
|
5
|
|
19
|
use warnings; |
|
|
5
|
|
|
|
|
42
|
|
|
|
5
|
|
|
|
|
3277
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $counter = 0; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new |
|
10
|
|
|
|
|
|
|
{ |
|
11
|
377
|
|
|
377
|
1
|
545
|
my ($class,) = @_; |
|
12
|
377
|
|
|
|
|
518
|
my $this = {}; |
|
13
|
377
|
|
|
|
|
522
|
bless ($this,$class); |
|
14
|
377
|
|
|
|
|
666
|
$this->{ID} = $counter++; |
|
15
|
377
|
|
|
|
|
547
|
$this->{SENTENCE} = (); |
|
16
|
377
|
|
|
|
|
509
|
$this->{START_CHAR} = (); |
|
17
|
377
|
|
|
|
|
469
|
$this->{END_CHAR} = (); |
|
18
|
377
|
|
|
|
|
464
|
$this->{MAXIMAL} = (); |
|
19
|
377
|
|
|
|
|
650
|
return $this; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub getSentence |
|
23
|
|
|
|
|
|
|
{ |
|
24
|
1245
|
|
|
1245
|
1
|
1466
|
my ($this) = @_; |
|
25
|
1245
|
|
|
|
|
2208
|
return $this->{SENTENCE}; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub getStartChar |
|
29
|
|
|
|
|
|
|
{ |
|
30
|
915
|
|
|
915
|
1
|
1519
|
my ($this) = @_; |
|
31
|
915
|
|
|
|
|
1839
|
return $this->{START_CHAR}; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub getEndChar |
|
35
|
|
|
|
|
|
|
{ |
|
36
|
333
|
|
|
333
|
1
|
452
|
my ($this) = @_; |
|
37
|
333
|
|
|
|
|
677
|
return $this->{END_CHAR}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub getID |
|
41
|
|
|
|
|
|
|
{ |
|
42
|
330
|
|
|
330
|
1
|
434
|
my ($this) = @_; |
|
43
|
330
|
|
|
|
|
741
|
return $this->{ID}; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub getDocument |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
660
|
|
|
660
|
1
|
869
|
my ($this) = @_; |
|
49
|
660
|
|
|
|
|
837
|
return $this->getSentence->getDocument; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub isMaximal |
|
53
|
|
|
|
|
|
|
{ |
|
54
|
650
|
|
|
650
|
1
|
850
|
my ($this) = @_; |
|
55
|
650
|
|
|
|
|
1348
|
return $this->{MAXIMAL}; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub setInfoForPhrase |
|
59
|
|
|
|
|
|
|
{ |
|
60
|
122
|
|
|
122
|
1
|
179
|
my ($this,$words_a,$maximal) = @_; |
|
61
|
122
|
|
|
|
|
165
|
my $first = $words_a->[0]; |
|
62
|
122
|
|
|
|
|
201
|
my $last = $words_a->[$#$words_a]; |
|
63
|
122
|
|
|
|
|
266
|
$this->{SENTENCE} = $first->getSentence; |
|
64
|
122
|
|
|
|
|
234
|
$this->{START_CHAR} = $first->getStartChar; |
|
65
|
122
|
|
|
|
|
205
|
$this->{END_CHAR} = $last->getStartChar + $last->getLexItem->getLength; |
|
66
|
122
|
|
|
|
|
224
|
$this->{MAXIMAL} = $maximal; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub setInfoForTestifiedTerm |
|
70
|
|
|
|
|
|
|
{ |
|
71
|
3
|
|
|
3
|
1
|
7
|
my ($this,$sentence,$start_char,$end_char) = @_; |
|
72
|
3
|
|
|
|
|
5
|
$this->{SENTENCE} = $sentence; |
|
73
|
3
|
|
|
|
|
4
|
$this->{START_CHAR} = $start_char; |
|
74
|
3
|
|
|
|
|
5
|
$this->{END_CHAR} = $end_char; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub print |
|
78
|
|
|
|
|
|
|
{ |
|
79
|
0
|
|
|
0
|
1
|
|
my ($this,$fh) = @_; |
|
80
|
0
|
0
|
|
|
|
|
if(defined $fh) |
|
81
|
|
|
|
|
|
|
{ |
|
82
|
0
|
|
|
|
|
|
print $fh "DOC: " . $this->getDocument . " - SENT: " . $this->getSentence . " from: " . $this->getStartChar . " to: " .$this->getEndChar . "\n"; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
else |
|
85
|
|
|
|
|
|
|
{ |
|
86
|
0
|
|
|
|
|
|
print "DOC: " . $this->getDocument->getID . " - SENT: " . $this->getSentence->getID . " from: " . $this->getStartChar . " to: " .$this->getEndChar . "\n"; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub isNotBest |
|
91
|
|
|
|
|
|
|
{ |
|
92
|
0
|
|
|
0
|
1
|
|
my ($this,$other_occurrences_a,$parsing_direction) = @_; |
|
93
|
0
|
|
|
|
|
|
my $other; |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
foreach $other (@$other_occurrences_a) |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
0
|
0
|
|
|
|
|
if($this->isIncludedIn($other)) # best is the largest |
|
98
|
|
|
|
|
|
|
{ |
|
99
|
0
|
|
|
|
|
|
return 1; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
# best is the one that has the position corresponding to the parsing direction (ex: leftmost TT for parsing direction = LEFT) |
|
102
|
0
|
0
|
|
|
|
|
if($this->crossesWithoutPriority($other,$parsing_direction)) |
|
103
|
|
|
|
|
|
|
{ |
|
104
|
0
|
|
|
|
|
|
return 1; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
} |
|
107
|
0
|
|
|
|
|
|
return; |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub crossesWithoutPriority |
|
112
|
|
|
|
|
|
|
{ |
|
113
|
0
|
|
|
0
|
1
|
|
my ($this,$other,$parsing_direction) = @_; |
|
114
|
0
|
0
|
0
|
|
|
|
if( |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
115
|
|
|
|
|
|
|
($this->getStartChar > $other->getStartChar) |
|
116
|
|
|
|
|
|
|
&& |
|
117
|
|
|
|
|
|
|
($this->getStartChar < $other->getEndChar) |
|
118
|
|
|
|
|
|
|
&& |
|
119
|
|
|
|
|
|
|
($this->getEndChar > $other->getEndChar) |
|
120
|
|
|
|
|
|
|
&& |
|
121
|
|
|
|
|
|
|
($parsing_direction eq "LEFT") |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
) |
|
124
|
|
|
|
|
|
|
{ |
|
125
|
0
|
|
|
|
|
|
return 1; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
0
|
0
|
0
|
|
|
|
if( |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
128
|
|
|
|
|
|
|
($this->getEndChar < $other->getEndChar) |
|
129
|
|
|
|
|
|
|
&& |
|
130
|
|
|
|
|
|
|
($this->getEndChar > $other->getStartChar) |
|
131
|
|
|
|
|
|
|
&& |
|
132
|
|
|
|
|
|
|
($this->getStartChar < $other->getStartChar) |
|
133
|
|
|
|
|
|
|
&& |
|
134
|
|
|
|
|
|
|
($parsing_direction eq "RIGHT") |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
) |
|
137
|
|
|
|
|
|
|
{ |
|
138
|
0
|
|
|
|
|
|
return 1; |
|
139
|
|
|
|
|
|
|
} |
|
140
|
0
|
|
|
|
|
|
return; |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub isIncludedIn |
|
144
|
|
|
|
|
|
|
{ |
|
145
|
0
|
|
|
0
|
1
|
|
my ($this,$other) = @_; |
|
146
|
0
|
0
|
0
|
|
|
|
if( |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
147
|
|
|
|
|
|
|
( |
|
148
|
|
|
|
|
|
|
($this->getStartChar >= $other->getStartChar) |
|
149
|
|
|
|
|
|
|
&& |
|
150
|
|
|
|
|
|
|
($this->getEndChar < $other->getEndChar) |
|
151
|
|
|
|
|
|
|
) |
|
152
|
|
|
|
|
|
|
|| |
|
153
|
|
|
|
|
|
|
( |
|
154
|
|
|
|
|
|
|
( |
|
155
|
|
|
|
|
|
|
($this->getStartChar > $other->getStartChar) |
|
156
|
|
|
|
|
|
|
&& |
|
157
|
|
|
|
|
|
|
($this->getEndChar <= $other->getEndChar) |
|
158
|
|
|
|
|
|
|
) |
|
159
|
|
|
|
|
|
|
) |
|
160
|
|
|
|
|
|
|
) |
|
161
|
|
|
|
|
|
|
{ |
|
162
|
0
|
|
|
|
|
|
return 1; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
0
|
|
|
|
|
|
return; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
1; |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
__END__ |