| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 34 | 0 | ▶ | my $ret = $tb->{$_} // "<UNKNOWN FIELD $_>"; | ||||||||||||
|
Condition0%0/2
$tb->{$_} // "<UNKNOWN FIELD $_>"
MC/DC0%0/1
$tb->{$_} // "<UNKNOWN FIELD $_>"
$tb->{$_}
Truth table0%0/2
A
A= $tb->{$_}
| |||||||||||||||
| 35 | 0 | ▶ | ref($ret) ? $json->encode($ret) : $ret; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 36 | 0 | } split(/[,; |]/,$config->{info}->{fields}) )} @$treebanks | |||||||||||||
| 37 | ),"\n"; | ||||||||||||||
| 38 | 0 | ▶ | print STDERR "Possible fields: ", join( " ", keys %{$treebanks->[0]}) if $unknown; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 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__ | ||||||||||||||