line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PMLTQ::Command::suggest; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:MATY'; |
3
|
|
|
|
|
|
|
$PMLTQ::Command::suggest::VERSION = '1.1.0'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Return query for given nodes |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
181445
|
use PMLTQ::Base 'PMLTQ::Command'; |
|
1
|
|
|
|
|
3441
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
149323
|
use PMLTQ; |
|
1
|
|
|
|
|
25379
|
|
|
1
|
|
|
|
|
83
|
|
8
|
1
|
|
|
1
|
|
562
|
use PMLTQ::Suggest::Utils; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
9
|
1
|
|
|
1
|
|
543
|
use PMLTQ::Suggest; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
20
|
|
10
|
1
|
|
|
1
|
|
40
|
use File::Path qw( make_path ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
61
|
|
11
|
1
|
|
|
1
|
|
917
|
use Getopt::Long qw(GetOptionsFromArray); |
|
1
|
|
|
|
|
10706
|
|
|
1
|
|
|
|
|
11
|
|
12
|
1
|
|
|
1
|
|
198
|
use Treex::PML; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
398
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has usage => sub { shift->extract_usage }; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my %opts; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub run { |
19
|
8
|
|
|
8
|
0
|
55891
|
my $self = shift; |
20
|
8
|
|
|
|
|
29
|
my @args = @_; |
21
|
8
|
50
|
|
|
|
67
|
GetOptionsFromArray(\@args, \%opts, |
22
|
|
|
|
|
|
|
'nodes|N=s' |
23
|
|
|
|
|
|
|
) || die "invalid options"; |
24
|
|
|
|
|
|
|
Treex::PML::AddResourcePath( |
25
|
|
|
|
|
|
|
PMLTQ->resources_dir, |
26
|
|
|
|
|
|
|
File::Spec->catfile(${FindBin::RealBin},'config'), |
27
|
|
|
|
|
|
|
$ENV{HOME}.'/.tred.d', |
28
|
|
|
|
|
|
|
$self->config->{resources} |
29
|
8
|
|
|
|
|
3220
|
); |
30
|
8
|
50
|
|
|
|
832
|
my @paths = $opts{nodes} ? split(/\|/, $opts{nodes}) : (); |
31
|
8
|
|
|
|
|
18
|
my @positions; |
32
|
8
|
|
|
|
|
33
|
foreach my $p (@paths) { |
33
|
15
|
|
|
|
|
64
|
my ($path, $goto)=PMLTQ::Suggest::Utils::parse_file_suffix($p); |
34
|
15
|
|
|
|
|
107
|
$path = URI->new($path)->canonical->as_string; |
35
|
15
|
|
|
|
|
1279
|
push @positions, [$path,$goto]; |
36
|
|
|
|
|
|
|
} |
37
|
8
|
|
|
|
|
54
|
my $pmltq = PMLTQ::Suggest::make_pmltq( |
38
|
|
|
|
|
|
|
\@positions |
39
|
|
|
|
|
|
|
); |
40
|
8
|
|
|
|
|
28724
|
Encode::_utf8_off($pmltq); |
41
|
8
|
|
|
|
|
403616
|
print "$pmltq\n"; |
42
|
8
|
|
|
|
|
195
|
return 1; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
pmltq suggest [--resources="path to resources directory"] --nodes "FILE2#NODE_ID1|FILE2#NODE_ID2|..." |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Return query for given nodes. It works on local PML files. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 OPTIONS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 PARAMS |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=over 5 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item B |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Path to configuration file. If a treebank_config is --, config is readed from STDIN. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=back |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |