line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::ParsingPatternRecordSet; |
2
|
5
|
|
|
5
|
|
43
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
191
|
|
3
|
5
|
|
|
5
|
|
28
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
157
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
2047
|
use Lingua::YaTeA::ParsingPatternRecord; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
62
|
|
6
|
5
|
|
|
5
|
|
162
|
use Lingua::YaTeA::ParsingPattern; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
36
|
|
7
|
5
|
|
|
5
|
|
2344
|
use Lingua::YaTeA::ParsingPatternParser; |
|
5
|
|
|
|
|
38
|
|
|
5
|
|
|
|
|
45
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $max_content_words = 0; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
4
|
|
|
4
|
1
|
16
|
my ($class,$file_path,$tag_set,$message_set,$display_language) = @_; |
16
|
4
|
|
|
|
|
12
|
my $this = {}; |
17
|
4
|
|
|
|
|
11
|
bless ($this,$class); |
18
|
4
|
|
|
|
|
28
|
$this->{PARSING_RECORDS} = {}; |
19
|
4
|
|
|
|
|
23
|
$this->loadPatterns($file_path,$tag_set,$message_set,$display_language); |
20
|
4
|
|
|
|
|
873
|
return $this; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub loadPatterns |
24
|
|
|
|
|
|
|
{ |
25
|
4
|
|
|
4
|
1
|
14
|
my ($this,$file_path,$tag_set,$message_set,$display_language) = @_; |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
|
|
29
|
my $fh = FileHandle->new("<$file_path"); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
4
|
|
|
|
|
417
|
my $parser = Lingua::YaTeA::ParsingPatternParser->new(); |
31
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
50
|
$parser->YYData->{PPRS} = $this; |
33
|
4
|
|
|
|
|
61
|
$parser->YYData->{FH} = $fh; |
34
|
4
|
|
|
|
|
38
|
$parser->YYData->{CANDIDATES} = $tag_set->getTagList("CANDIDATES"); |
35
|
4
|
|
|
|
|
34
|
$parser->YYData->{PREPOSITIONS} = $tag_set->getTagList("PREPOSITIONS"); |
36
|
4
|
|
|
|
|
32
|
$parser->YYData->{DETERMINERS} = $tag_set->getTagList("DETERMINERS"); |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
60
|
$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
|
1836
|
my ($this,$num_content_words,$num_line) = @_; |
47
|
280
|
50
|
|
|
|
754
|
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
|
2064
|
my ($this,$pattern) = @_; |
56
|
280
|
|
|
|
|
453
|
my $record; |
57
|
280
|
50
|
|
|
|
655
|
if (! $this->existRecord($pattern->getPOSSequence)) |
58
|
|
|
|
|
|
|
{ |
59
|
280
|
|
|
|
|
630
|
$record = $this->addRecord($pattern->getPOSSequence); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
|
|
0
|
$record = $this->getRecord($pattern->getPOSSequence); |
64
|
|
|
|
|
|
|
} |
65
|
280
|
|
|
|
|
780
|
$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
|
502
|
my ($this,$name) = @_; |
77
|
280
|
|
|
|
|
813
|
$this->{PARSING_RECORDS}->{$name} = Lingua::YaTeA::ParsingPatternRecord->new($name); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub existRecord |
82
|
|
|
|
|
|
|
{ |
83
|
353
|
|
|
353
|
1
|
757
|
my ($this,$name) = @_; |
84
|
353
|
100
|
|
|
|
1019
|
if (exists $this->{PARSING_RECORDS}{$name}) |
85
|
|
|
|
|
|
|
{ |
86
|
46
|
|
|
|
|
206
|
return $this->{PARSING_RECORDS}{$name}; |
87
|
|
|
|
|
|
|
} |
88
|
307
|
|
|
|
|
727
|
return 0; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub getRecordSet |
92
|
|
|
|
|
|
|
{ |
93
|
4828
|
|
|
4828
|
1
|
8689
|
my ($this) = @_; |
94
|
4828
|
|
|
|
|
17614
|
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__ |