line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::Lexicon; |
2
|
3
|
|
|
3
|
|
21
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
85
|
|
3
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
81
|
|
4
|
3
|
|
|
3
|
|
1214
|
use Lingua::YaTeA::LexiconItem; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
33
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
5
|
|
|
5
|
1
|
14
|
my ($class) = @_; |
11
|
5
|
|
|
|
|
15
|
my $this = {}; |
12
|
5
|
|
|
|
|
9
|
bless ($this,$class); |
13
|
5
|
|
|
|
|
22
|
$this->{ITEMS} = {}; |
14
|
5
|
|
|
|
|
16
|
return $this; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub addItem |
18
|
|
|
|
|
|
|
{ |
19
|
320
|
|
|
320
|
1
|
501
|
my ($this,$item,$key) = @_; |
20
|
320
|
|
|
|
|
827
|
$this->{ITEMS}->{$key} = $item; |
21
|
320
|
|
|
|
|
581
|
$Lingua::YaTeA::LexiconItem::counter++; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub addOccurrence |
28
|
|
|
|
|
|
|
{ |
29
|
600
|
|
|
600
|
1
|
1025
|
my ($this,$form) = @_; |
30
|
600
|
|
|
|
|
1308
|
my $item = Lingua::YaTeA::LexiconItem->new($form); |
31
|
600
|
|
|
|
|
1172
|
my $key = $this->buildKey($item); |
32
|
600
|
100
|
|
|
|
1104
|
if (itemExists($this,$key) == 0) |
33
|
|
|
|
|
|
|
{ |
34
|
320
|
|
|
|
|
591
|
$this->addItem($item,$key); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else |
37
|
|
|
|
|
|
|
{ |
38
|
280
|
|
|
|
|
546
|
$item = $this->getItem($key); |
39
|
|
|
|
|
|
|
} |
40
|
600
|
|
|
|
|
1601
|
$item->incrementFrequency; |
41
|
600
|
|
|
|
|
1341
|
return $item; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub getItem |
45
|
|
|
|
|
|
|
{ |
46
|
280
|
|
|
280
|
1
|
483
|
my ($this,$key) = @_; |
47
|
280
|
|
|
|
|
974
|
return $this->{ITEMS}->{$key}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub itemExists |
51
|
|
|
|
|
|
|
{ |
52
|
600
|
|
|
600
|
1
|
976
|
my ($this,$key) = @_; |
53
|
600
|
100
|
|
|
|
1620
|
if (exists $this->{ITEMS}->{$key}){ |
54
|
280
|
|
|
|
|
644
|
return 1; |
55
|
|
|
|
|
|
|
} |
56
|
320
|
|
|
|
|
664
|
return 0; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub buildKey |
60
|
|
|
|
|
|
|
{ |
61
|
600
|
|
|
600
|
1
|
1015
|
my ($this,$item) = @_; |
62
|
600
|
|
|
|
|
1290
|
my $key = $item->{IF}.$item->{POS}.$item->{LF}; |
63
|
600
|
|
|
|
|
1092
|
return $key; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |