DiaColloDB
view release on metacpan or search on metacpan
dcdb-query.perl view on Meta::CPAN
cutoff =>undef, ##-- minimum score cutoff
global =>0, ##-- trim globally (vs. slice-locally)?
strings => 1, ##-- debug: want strings?
onepass => 0, ##-- use fast but incorrect 1-pass method?
);
our %save = (format=>undef);
our $outfmt = 'text'; ##-- output format: 'text' or 'json'
our $pretty = 1;
our $dotime = 1; ##-- report timing?
our $niters = 1; ##-- number of benchmark iterations
##----------------------------------------------------------------------
## Command-line processing
##----------------------------------------------------------------------
GetOptions(##-- general
'help|h' => \$help,
'version|V' => \$version,
##-- general
'log-level|level|log=s' => sub { $log{level} = uc($_[1]); },
dcdb-query.perl view on Meta::CPAN
##-- I/O
'user|U=s' => \$http_user,
'text|t' => sub {$outfmt='text'},
'json|j' => sub {$outfmt='json'},
'html' => sub {$outfmt='html'},
'pretty|p!' => \$pretty,
'ugly!' => sub {$pretty=!$_[1]},
'null|noout' => sub {$outfmt=''},
'score-format|sf|format|fmt=s' => \$save{format},
'timing|times|time|T!' => \$dotime,
'bench|n-iterations|iterations|iters|i=i' => \$niters,
);
if ($version) {
print STDERR "$prog version $DiaColloDB::VERSION by Bryan Jurish\n";
exit 0 if ($version);
}
pod2usage({-exitval=>0,-verbose=>0}) if ($help);
pod2usage({-exitval=>1,-verbose=>0,-msg=>"$prog: ERROR: no DBURL specified!"}) if (@ARGV<1);
pod2usage({-exitval=>1,-verbose=>0,-msg=>"$prog: ERROR: no QUERY specified!"}) if (@ARGV<2);
dcdb-query.perl view on Meta::CPAN
#($rel,@query{qw(slice query groupby)}) = ('tdf',0,'Zahnstange && Nuth','basename');
#($rel,@query{qw(slice query groupby)}) = ('tdf',0,'Zahnstange #has[basename,fischer_w*]','basename');
##
#($rel,@query{qw(slice groupby query)}) = ('ddc',0,'l','"(ge* &= $p=ADJA)=2 $l=@Maschine" #fmin 1'); ##-- xykeys-like f2 bug
#($rel,@query{qw(slice groupby query)}) = ('ddc',0,'l','Haus=2 || Garten=1 #fmin 1'); ##-- xykeys-like f2 bug
#($rel,@query{qw(slice groupby query)}) = ('ddc',0,'l','"*=2 Mansch" #fmin 1'); ##-- missing {schön,ganz,",d} from list-client (was cutoff=>0, fixed with cutoff=>'' in Client::list)
}
##--/DEBUG queries
if ($niters != 1) {
$cli->info("performing $niters query iterations");
}
my $timer = DiaColloDB::Timer->start();
foreach my $iter (1..$niters) {
my $mp = $cli->query($rel, %query)
or die("$prog: query() failed for relation '$rel', query '$query{query}'".($isDiff ? " - '$query{bquery}'" : '').": $cli->{error}");
##-- dump stringified query
my $outfile = ($iter==1 ? '-' : '/dev/null');
if ($outfmt eq 'text') {
$mp->trace("saveTextFile()");
dcdb-query.perl view on Meta::CPAN
dcdb-query.perl - query a DiaColloDB diachronic collocation database
=head1 SYNOPSIS
dcdb-query.perl [OPTIONS] DBURL QUERY1 [QUERY2]
General Options:
-help # display a brief usage summary
-version # display program version
-[no]time # do/don't report operation timing (default=do)
-iters NITERS # benchmark NITERS iterations of query
Query Options:
-col, -ug, -ddc, -tdf # select profile type (collocations, unigrams, ddc client, tdf matrix; default=-col)
-(a|b)?date DATES # set target DATE or /REGEX/ or MIN-MAX
-(a|b)?slice SLICE # set target date slice (default=1)
-groupby GROUPBY # set result aggregation (default=l)
-kbest KBEST # return only KBEST items per date-slice (default=10)
-nokbest # disable k-best pruning
-cutoff CUTOFF # set minimum score for returned items (default=none)
-nocutoff # disable cutoff pruning
dcdb-query.perl view on Meta::CPAN
Display version information and exit.
=item -time
=item -notime
Do/don't report operation timing (default=do).
=item -iters NITERS
Benchmark NITERS iterations of query (default=1).
=back
=cut
###############################################################
# Query Options
=pod
=head2 Query Options
( run in 1.865 second using v1.01-cache-2.11-cpan-71847e10f99 )