line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::WordOccurrence; |
2
|
3
|
|
|
3
|
|
22
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
83
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
70
|
|
4
|
3
|
|
|
3
|
|
396
|
use Lingua::YaTeA::ChunkingDataSet; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
26
|
|
5
|
3
|
|
|
3
|
|
66
|
use UNIVERSAL; |
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
14
|
|
6
|
3
|
|
|
3
|
|
102
|
use Scalar::Util qw(blessed); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1820
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new |
11
|
|
|
|
|
|
|
{ |
12
|
616
|
|
|
616
|
1
|
1028
|
my ($class,$form) = @_; |
13
|
616
|
|
|
|
|
1076
|
my $this = {}; |
14
|
616
|
|
|
|
|
1125
|
bless ($this,$class); |
15
|
616
|
|
|
|
|
1214
|
$this->{FORM} = $this->setForm($form); |
16
|
616
|
|
|
|
|
1401
|
return $this; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub setForm |
20
|
|
|
|
|
|
|
{ |
21
|
616
|
|
|
616
|
1
|
1067
|
my ($this,$form) = @_; |
22
|
616
|
|
|
|
|
1802
|
$this->{FORM} = $form; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub getForm |
26
|
|
|
|
|
|
|
{ |
27
|
612
|
|
|
612
|
1
|
1081
|
my ($this,$form) = @_; |
28
|
612
|
|
|
|
|
2975
|
return $this->{FORM}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub isChunkEnd |
32
|
|
|
|
|
|
|
{ |
33
|
612
|
|
|
612
|
1
|
1414
|
my ($this,$action,$split_after,$sentence_boundary,$document_boundary,$chunking_data) = @_; |
34
|
|
|
|
|
|
|
|
35
|
612
|
100
|
66
|
|
|
3167
|
if ((blessed($this)) && ($this->isa("Lingua::YaTeA::WordFromCorpus"))) |
36
|
|
|
|
|
|
|
{ |
37
|
594
|
100
|
|
|
|
1259
|
if ($Lingua::YaTeA::Corpus::tt_counter != 0){ # word is between testified term frontiers: not end |
38
|
6
|
|
|
|
|
19
|
return 0; |
39
|
|
|
|
|
|
|
} |
40
|
588
|
|
|
|
|
858
|
$$split_after--; |
41
|
588
|
100
|
|
|
|
1108
|
if($$split_after == 0) |
42
|
|
|
|
|
|
|
{ |
43
|
2
|
|
|
|
|
8
|
return 1; |
44
|
|
|
|
|
|
|
} |
45
|
586
|
100
|
66
|
|
|
1279
|
if ( # word is a sentence or document boundary : end |
46
|
|
|
|
|
|
|
($this->isSentenceBoundary($sentence_boundary) == 1) |
47
|
|
|
|
|
|
|
|| |
48
|
|
|
|
|
|
|
($this->isDocumentBoundary($document_boundary) == 1) |
49
|
|
|
|
|
|
|
) |
50
|
|
|
|
|
|
|
{ |
51
|
18
|
|
|
|
|
70
|
return 1; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
# Test if word is a chunking frontier |
54
|
568
|
100
|
|
|
|
1284
|
if ($this->isChunkingFrontier($chunking_data)) |
55
|
|
|
|
|
|
|
{ |
56
|
214
|
50
|
|
|
|
441
|
if($Lingua::YaTeA::Corpus::tt_counter == 0) |
57
|
|
|
|
|
|
|
{ |
58
|
214
|
|
|
|
|
784
|
return 1; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else{ |
64
|
18
|
100
|
66
|
|
|
128
|
if ((blessed($this)) && ($this->isa("Lingua::YaTeA::ForbiddenStructureMark"))) |
65
|
|
|
|
|
|
|
{ |
66
|
12
|
100
|
|
|
|
46
|
if ($this->isOpener) |
67
|
|
|
|
|
|
|
{ |
68
|
6
|
|
|
|
|
13
|
$Lingua::YaTeA::Corpus::forbidden_counter ++; |
69
|
6
|
|
|
|
|
21
|
$$action = $this->getAction; |
70
|
6
|
100
|
|
|
|
24
|
if($$action eq "split") |
71
|
|
|
|
|
|
|
{ |
72
|
|
|
|
|
|
|
|
73
|
2
|
|
|
|
|
10
|
$$split_after = $this->getSplitAfter +1; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
else{ |
77
|
6
|
50
|
|
|
|
23
|
if ($this->isCloser) |
78
|
|
|
|
|
|
|
{ |
79
|
6
|
|
|
|
|
12
|
$Lingua::YaTeA::Corpus::forbidden_counter --; |
80
|
6
|
100
|
66
|
|
|
30
|
if (($Lingua::YaTeA::Corpus::tt_counter == 0) && ($this->getAction ne "split")) { |
81
|
|
|
|
|
|
|
# warn "==>1\n"; |
82
|
4
|
|
|
|
|
19
|
return 1; |
83
|
|
|
|
|
|
|
} else { |
84
|
2
|
|
|
|
|
11
|
return(0); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
else{ |
88
|
0
|
|
|
|
|
0
|
die "erreur\n"; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
else |
93
|
|
|
|
|
|
|
{ |
94
|
6
|
50
|
33
|
|
|
35
|
if ((blessed($this)) && ($this->isa('Lingua::YaTeA::TestifiedTermMark'))) { |
95
|
6
|
100
|
|
|
|
20
|
if ($this->isOpener) |
96
|
|
|
|
|
|
|
{ |
97
|
3
|
|
|
|
|
6
|
$Lingua::YaTeA::Corpus::tt_counter++; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
else |
100
|
|
|
|
|
|
|
{ |
101
|
3
|
50
|
|
|
|
10
|
if ($this->isCloser) |
102
|
|
|
|
|
|
|
{ |
103
|
3
|
|
|
|
|
6
|
$Lingua::YaTeA::Corpus::tt_counter--; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
} |
106
|
6
|
|
|
|
|
22
|
return 0; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
360
|
100
|
66
|
|
|
1703
|
if( # word is in a forbidden structure but out of testified term frontiers: end |
112
|
|
|
|
|
|
|
($Lingua::YaTeA::Corpus::forbidden_counter != 0) |
113
|
|
|
|
|
|
|
&& |
114
|
|
|
|
|
|
|
($Lingua::YaTeA::Corpus::tt_counter == 0) |
115
|
|
|
|
|
|
|
) |
116
|
|
|
|
|
|
|
{ |
117
|
12
|
100
|
|
|
|
40
|
if ($$action eq "delete") |
118
|
|
|
|
|
|
|
{ |
119
|
8
|
|
|
|
|
38
|
return 1; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
else{ |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# $Lingua::YaTeA::Corpus::split_counter--; |
124
|
|
|
|
|
|
|
# if($Lingua::YaTeA::Corpus::split_counter == 0) |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
#return 0; |
127
|
|
|
|
|
|
|
} |
128
|
4
|
|
|
|
|
17
|
return 0; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub print |
135
|
|
|
|
|
|
|
{ |
136
|
612
|
|
|
612
|
1
|
1110
|
my ($this,$fh) = @_; |
137
|
612
|
50
|
|
|
|
1262
|
if(defined $fh) |
138
|
|
|
|
|
|
|
{ |
139
|
612
|
|
|
|
|
1326
|
print $fh $this->getForm . "\n"; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
else |
142
|
|
|
|
|
|
|
{ |
143
|
0
|
|
|
|
|
|
print $this->getForm . "\n"; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
1; |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
__END__ |