line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::wd_simple_strings; |
2
|
|
|
|
|
|
|
#ABSTRACT: Simplify labels, descriptions, and aliases of Wikidata entity records |
3
|
|
|
|
|
|
|
our $VERSION = '0.06'; #VERSION |
4
|
1
|
|
|
1
|
|
1466
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
5
|
1
|
|
|
1
|
|
226
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub fix { |
8
|
0
|
|
|
0
|
0
|
|
my ($self, $data) = @_; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
|
|
|
foreach my $what (qw(labels descriptions)) { |
11
|
0
|
|
|
|
|
|
my $hash = $data->{$what}; |
12
|
0
|
0
|
|
|
|
|
if ($hash) { |
13
|
0
|
|
|
|
|
|
foreach my $lang (keys %$hash) { |
14
|
0
|
|
|
|
|
|
$hash->{$lang} = $hash->{$lang}->{value}; |
15
|
|
|
|
|
|
|
}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
if (my $hash = $data->{aliases}) { |
20
|
0
|
|
|
|
|
|
foreach my $lang (keys %$hash) { |
21
|
0
|
|
|
|
|
|
$hash->{$lang} = [ map { $_->{value} } @{$hash->{$lang}} ]; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
$data; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |