| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Wiktionary::Parser::Section::Classifications; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
17
|
use Wiktionary::Parser::Section; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
81
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
14
|
use base qw(Wiktionary::Parser::Section); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
11816
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
|
8
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
9
|
0
|
|
|
|
|
|
my %args = @_; |
|
10
|
0
|
|
|
|
|
|
my $self = bless Wiktionary::Parser::Section->new(%args), $class; |
|
11
|
0
|
|
|
|
|
|
return $self; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# add a line of content to this section and parse it into its component parts |
|
17
|
|
|
|
|
|
|
sub add_content { |
|
18
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
19
|
0
|
|
|
|
|
|
my $line = shift; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# * {{sense|swindler}} [[swindler]], [[cheat]] |
|
22
|
|
|
|
|
|
|
# * {{l|en|blee}} |
|
23
|
|
|
|
|
|
|
# * {{l|pt|para|gloss=[[to]], [[for]]}} |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
0
|
|
|
|
my $language = $self->get_language() || ''; |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
if ($line =~ m/^\*\s\{\{([^\}]+)\}\}/) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $meta = $1; |
|
29
|
0
|
|
|
|
|
|
my @meta_parts = split(/\|/,$meta); |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my @lexemes = $line =~ m/\[\[([^\]]+)\]\]/g; |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if ($meta_parts[0] =~ m/sense/i) { |
|
|
|
0
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$self->add_group( |
|
35
|
|
|
|
|
|
|
sense => $meta_parts[1], |
|
36
|
|
|
|
|
|
|
language => $language, |
|
37
|
|
|
|
|
|
|
lexemes => \@lexemes, |
|
38
|
|
|
|
|
|
|
) |
|
39
|
|
|
|
|
|
|
} elsif ($meta_parts[0] =~ m/^l$/) { |
|
40
|
0
|
|
|
|
|
|
my @lexemes; |
|
41
|
0
|
|
|
|
|
|
push @lexemes, $meta_parts[2]; |
|
42
|
0
|
|
|
|
|
|
push @lexemes, $line =~ m/\[\[([^\]]+)\]\]/g; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
0
|
|
|
|
$self->add_group( |
|
45
|
|
|
|
|
|
|
sense => $self->get_document()->get_title(), |
|
46
|
|
|
|
|
|
|
language => $language || $meta_parts[1], |
|
47
|
|
|
|
|
|
|
lexemes => \@lexemes, |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
# (''in the future''): [[backward]], [[backwards]], into the [[past]] |
|
51
|
|
|
|
|
|
|
} elsif ($line =~ m/\(\'+([^\']+)\'+\)/) { |
|
52
|
0
|
|
|
|
|
|
my $sense = $1; |
|
53
|
0
|
|
|
|
|
|
my @lexemes = $line =~ m/\[\[([^\]]+)\]\]/g; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$self->add_group( |
|
56
|
|
|
|
|
|
|
sense => $sense, |
|
57
|
|
|
|
|
|
|
language => $language, |
|
58
|
|
|
|
|
|
|
lexemes => \@lexemes, |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
} elsif ($line =~ m/Wikisaurus/) { |
|
62
|
|
|
|
|
|
|
# add wikisaurus tags (e.g. Wikisaurus:cat) |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my @links = $line =~ m/\[\[([^\]]+)\]\]/g; |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
for my $link (@links) { |
|
67
|
0
|
|
|
|
|
|
my ($ws,$token) = split(/:/,$link); |
|
68
|
0
|
|
|
|
|
|
$self->add_group( |
|
69
|
|
|
|
|
|
|
sense => $token, |
|
70
|
|
|
|
|
|
|
language => $language, |
|
71
|
|
|
|
|
|
|
lexemes => [$link], |
|
72
|
|
|
|
|
|
|
); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
} else { |
|
76
|
0
|
|
|
|
|
|
my @lexemes = $line =~ m/\[\[([^\]]+)\]\]/g; |
|
77
|
0
|
|
|
|
|
|
$self->add_group( |
|
78
|
|
|
|
|
|
|
sense => $self->get_document()->get_title(), |
|
79
|
|
|
|
|
|
|
language => $language, |
|
80
|
|
|
|
|
|
|
lexemes => \@lexemes, |
|
81
|
|
|
|
|
|
|
) |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
push @{$self->{content}}, $line; |
|
|
0
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub add_group { |
|
89
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
90
|
0
|
|
|
|
|
|
my %args = @_; |
|
91
|
0
|
|
|
|
|
|
my $language = $args{language}; |
|
92
|
0
|
|
|
|
|
|
my $sense = $args{sense}; |
|
93
|
0
|
|
|
|
|
|
my $lexemes = $args{lexemes}; |
|
94
|
0
|
|
|
|
|
|
push @{$self->{groups}}, { |
|
|
0
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sense => $sense, |
|
96
|
|
|
|
|
|
|
language => $language, |
|
97
|
|
|
|
|
|
|
lexemes => $lexemes, |
|
98
|
|
|
|
|
|
|
}; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub get_groups { |
|
102
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
103
|
0
|
|
|
|
|
|
return $self->{groups}; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |