blib/lib/PMLTQ/Command/webtreebank.pm

filter: Statementstmt 41.0% 16 / 39 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 1 totaltotal 32.7% 20 / 61 CC 8 SCAR 38.0
CC
8
Cov
30%
run
72.0
__ANON__
1.1
BEGIN
1.0
CRAP 44.7
« blib/lib/PMLTQ/Relation/TreexFileIterator.pm ↑ Summary blib/lib/PMLTQ/Command/load.pm »
1 package PMLTQ::Command::webtreebank;
2 1 our $AUTHORITY = 'cpan:MATY';
3 1 $PMLTQ::Command::webtreebank::VERSION = '1.5.0';
4 # ABSTRACT: GET actions on treebanks on the web
5  
6 1 ▶use PMLTQ::Base 'PMLTQ::Command';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use YAML::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Hash::Merge 'merge';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 0 ▶has usage => sub { shift->extract_usage };
Subroutine __ANON__: not called CC=1 SCAR=1.2
12  
13 sub run {
14 0 ▶ my $self = shift;
Subroutine run: not called CC=8 SCAR=42.8
Pod undocumented
15 0 my $subcommand = shift;
16 0 my $config = $self->config;
17 0 ▶ unless($subcommand){
Branch: 1 branch
BranchTrueFalseTotal
unless ($subcommand) 0 0 0
18 0 say "Subcommand must be set.";
19 0 return 0;
20 }
21 0 my $ua = $self->ua;
22 0 $self->login($ua);
23 0 my $json = JSON->new;
24  
25 0 ▶ if($subcommand eq 'list'){
Branch: 2 branches
BranchTrueFalseTotal
if ($subcommand eq 'list') { } 0 0 0
elsif ($subcommand eq 'single') { } 0 0 0
26 0 my $treebanks = $self->get_all_treebanks($ua);
27 0 my $unknown = 0;
28 print join("\n",
29 map {
30 0 my $tb = $_;
31 join("\t",
32 map {
33 0 ▶ $unknown = 1 unless $tb->{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless $tb->{$_} 0 0 0
34 0 ▶ my $ret = $tb->{$_} // "<UNKNOWN FIELD $_>";
Condition0%0/2
$tb->{$_} // "<UNKNOWN FIELD $_>"
l!l
00
MC/DC0%0/1
$tb->{$_} // "<UNKNOWN FIELD $_>"
$tb->{$_}
Truth table0%0/2
A
A= $tb->{$_}
Aresult
11
00
35 0 ▶ ref($ret) ? $json->encode($ret) : $ret;
Branch: 1 branch
BranchTrueFalseTotal
ref $ret ? : 0 0 0
36 0 } split(/[,; |]/,$config->{info}->{fields}) )} @$treebanks
37 ),"\n";
38 0 ▶ print STDERR "Possible fields: ", join( " ", keys %{$treebanks->[0]}) if $unknown;
Branch: 1 branch
BranchTrueFalseTotal
if $unknown 0 0 0
39 } elsif($subcommand eq 'single') {
40 0 my $treebank = $self->get_treebank($ua);
41 print YAML::Tiny->new(merge(
42 merge( $config, $self->user2admin_format($treebank)),
43 {test_query => {
44 result_dir => 'query_results/'.$treebank->{name},
45 0 queries => $self->get_test_queries($treebank)
46 }}
47 )
48 )->write_string;
49 }
50 }
51  
52  
53 1 1;
54  
55 __END__
« blib/lib/PMLTQ/Relation/TreexFileIterator.pm ↑ Summary blib/lib/PMLTQ/Command/load.pm »