line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::Lexicon; |
2
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
22
|
|
|
3
|
|
|
|
|
92
|
|
3
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
80
|
|
4
|
3
|
|
|
3
|
|
1259
|
use Lingua::YaTeA::LexiconItem; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
35
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
5
|
|
|
5
|
1
|
14
|
my ($class) = @_; |
11
|
5
|
|
|
|
|
14
|
my $this = {}; |
12
|
5
|
|
|
|
|
13
|
bless ($this,$class); |
13
|
5
|
|
|
|
|
18
|
$this->{ITEMS} = {}; |
14
|
5
|
|
|
|
|
17
|
return $this; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub addItem |
18
|
|
|
|
|
|
|
{ |
19
|
320
|
|
|
320
|
1
|
576
|
my ($this,$item,$key) = @_; |
20
|
320
|
|
|
|
|
911
|
$this->{ITEMS}->{$key} = $item; |
21
|
320
|
|
|
|
|
573
|
$Lingua::YaTeA::LexiconItem::counter++; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub addOccurrence |
28
|
|
|
|
|
|
|
{ |
29
|
600
|
|
|
600
|
1
|
996
|
my ($this,$form) = @_; |
30
|
600
|
|
|
|
|
1341
|
my $item = Lingua::YaTeA::LexiconItem->new($form); |
31
|
600
|
|
|
|
|
1202
|
my $key = $this->buildKey($item); |
32
|
600
|
100
|
|
|
|
1149
|
if (itemExists($this,$key) == 0) |
33
|
|
|
|
|
|
|
{ |
34
|
320
|
|
|
|
|
677
|
$this->addItem($item,$key); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else |
37
|
|
|
|
|
|
|
{ |
38
|
280
|
|
|
|
|
620
|
$item = $this->getItem($key); |
39
|
|
|
|
|
|
|
} |
40
|
600
|
|
|
|
|
1701
|
$item->incrementFrequency; |
41
|
600
|
|
|
|
|
1499
|
return $item; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub getItem |
45
|
|
|
|
|
|
|
{ |
46
|
280
|
|
|
280
|
1
|
523
|
my ($this,$key) = @_; |
47
|
280
|
|
|
|
|
990
|
return $this->{ITEMS}->{$key}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub itemExists |
51
|
|
|
|
|
|
|
{ |
52
|
600
|
|
|
600
|
1
|
1104
|
my ($this,$key) = @_; |
53
|
600
|
100
|
|
|
|
1644
|
if (exists $this->{ITEMS}->{$key}){ |
54
|
280
|
|
|
|
|
667
|
return 1; |
55
|
|
|
|
|
|
|
} |
56
|
320
|
|
|
|
|
656
|
return 0; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub buildKey |
60
|
|
|
|
|
|
|
{ |
61
|
600
|
|
|
600
|
1
|
1052
|
my ($this,$item) = @_; |
62
|
600
|
|
|
|
|
1373
|
my $key = $item->{IF}.$item->{POS}.$item->{LF}; |
63
|
600
|
|
|
|
|
1103
|
return $key; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |