line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::ParsingPatternRecordSet; |
2
|
5
|
|
|
5
|
|
37
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
151
|
|
3
|
5
|
|
|
5
|
|
29
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
142
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
1930
|
use Lingua::YaTeA::ParsingPatternRecord; |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
62
|
|
6
|
5
|
|
|
5
|
|
162
|
use Lingua::YaTeA::ParsingPattern; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
18
|
|
7
|
5
|
|
|
5
|
|
2288
|
use Lingua::YaTeA::ParsingPatternParser; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
44
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $max_content_words = 0; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
4
|
|
|
4
|
1
|
19
|
my ($class,$file_path,$tag_set,$message_set,$display_language) = @_; |
16
|
4
|
|
|
|
|
14
|
my $this = {}; |
17
|
4
|
|
|
|
|
13
|
bless ($this,$class); |
18
|
4
|
|
|
|
|
30
|
$this->{PARSING_RECORDS} = {}; |
19
|
4
|
|
|
|
|
22
|
$this->loadPatterns($file_path,$tag_set,$message_set,$display_language); |
20
|
4
|
|
|
|
|
854
|
return $this; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub loadPatterns |
24
|
|
|
|
|
|
|
{ |
25
|
4
|
|
|
4
|
1
|
18
|
my ($this,$file_path,$tag_set,$message_set,$display_language) = @_; |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
|
|
31
|
my $fh = FileHandle->new("<$file_path"); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
4
|
|
|
|
|
342
|
my $parser = Lingua::YaTeA::ParsingPatternParser->new(); |
31
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
48
|
$parser->YYData->{PPRS} = $this; |
33
|
4
|
|
|
|
|
77
|
$parser->YYData->{FH} = $fh; |
34
|
4
|
|
|
|
|
41
|
$parser->YYData->{CANDIDATES} = $tag_set->getTagList("CANDIDATES"); |
35
|
4
|
|
|
|
|
72
|
$parser->YYData->{PREPOSITIONS} = $tag_set->getTagList("PREPOSITIONS"); |
36
|
4
|
|
|
|
|
36
|
$parser->YYData->{DETERMINERS} = $tag_set->getTagList("DETERMINERS"); |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
56
|
$parser->YYParse(yylex => \&Lingua::YaTeA::ParsingPatternParser::_Lexer, yyerror => \&Lingua::YaTeA::ParsingPatternParser::_Error); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# print STDERR "nberr: " . $parser->YYNberr() ."\n"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub checkContentWords |
45
|
|
|
|
|
|
|
{ |
46
|
280
|
|
|
280
|
1
|
1793
|
my ($this,$num_content_words,$num_line) = @_; |
47
|
280
|
50
|
|
|
|
704
|
if($num_content_words == 0) |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
|
|
0
|
die "No content word in pattern line " . $num_line . "\n"; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub addPattern |
54
|
|
|
|
|
|
|
{ |
55
|
280
|
|
|
280
|
1
|
1983
|
my ($this,$pattern) = @_; |
56
|
280
|
|
|
|
|
407
|
my $record; |
57
|
280
|
50
|
|
|
|
707
|
if (! $this->existRecord($pattern->getPOSSequence)) |
58
|
|
|
|
|
|
|
{ |
59
|
280
|
|
|
|
|
616
|
$record = $this->addRecord($pattern->getPOSSequence); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
|
|
0
|
$record = $this->getRecord($pattern->getPOSSequence); |
64
|
|
|
|
|
|
|
} |
65
|
280
|
|
|
|
|
746
|
$record->addPattern($pattern); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub getRecord |
69
|
|
|
|
|
|
|
{ |
70
|
0
|
|
|
0
|
1
|
0
|
my ($this,$name) = @_; |
71
|
0
|
|
|
|
|
0
|
return $this->{PARSING_RECORDS}->{$name}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub addRecord |
75
|
|
|
|
|
|
|
{ |
76
|
280
|
|
|
280
|
1
|
500
|
my ($this,$name) = @_; |
77
|
280
|
|
|
|
|
823
|
$this->{PARSING_RECORDS}->{$name} = Lingua::YaTeA::ParsingPatternRecord->new($name); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub existRecord |
82
|
|
|
|
|
|
|
{ |
83
|
353
|
|
|
353
|
1
|
691
|
my ($this,$name) = @_; |
84
|
353
|
100
|
|
|
|
982
|
if (exists $this->{PARSING_RECORDS}{$name}) |
85
|
|
|
|
|
|
|
{ |
86
|
46
|
|
|
|
|
178
|
return $this->{PARSING_RECORDS}{$name}; |
87
|
|
|
|
|
|
|
} |
88
|
307
|
|
|
|
|
723
|
return 0; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub getRecordSet |
92
|
|
|
|
|
|
|
{ |
93
|
4828
|
|
|
4828
|
1
|
7796
|
my ($this) = @_; |
94
|
4828
|
|
|
|
|
16282
|
return $this->{PARSING_RECORDS}; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub print |
100
|
|
|
|
|
|
|
{ |
101
|
0
|
|
|
0
|
1
|
|
my ($this) = @_; |
102
|
0
|
|
|
|
|
|
my $record; |
103
|
0
|
|
|
|
|
|
foreach $record (values %{$this->getRecordSet}) |
|
0
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
{ |
105
|
0
|
|
|
|
|
|
$record->print; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |