CWB::CQP::More - A higher level interface for CWB::CQP
use CWB::CQP::More; my $cqp = CWB::CQP::More->new( { utf8 => 1 } ); $cqp->change_corpus('HANSARDS'); # This needs to get fixed... not nice to say "'<b>'" $cqp->set(Context => [20, 'words'], LD => "'<b>'", RD => "'</b>'"); # using Try::Tiny... try { $cqp->exec('A = "dog";'); my $result_size = $cqp->size('A'); my @lines = $cqp->cat('A'); } catch { print "Error: $_\n"; } $cqp->annotation_show("pos"); $details = $cqp->corpora_details('hansards'); $available_corpora = $cqp->show_corpora; # for debug use CWB::CQP::More 'DEBUG';
This class superclasses CWB::CQP and adds some higher-order functionalities.
The new constructor has the same behavior has the CWB::CQP new method, unless the first argument is a hash reference. In that case, it is shifted and used as configuration for CWB::CQP::More. The remaining arguments are sent unaltered to CWB::CQP constructor.
new
CWB::CQP
CWB::CQP::More
Set utf8 mode on or off. Pass it a 1 or a 0 as argument. Returns that same value. If used without arguments, returns current value.
Uses the size CQP command to fetch the size of a query result set. Pass it its name, returns an integer. -1 if the result set does not exist or an error occurred.
size
-1
This method uses the cat method to return a result set. The first mandatory argument is the name of the result set. Second and Third arguments are optional, and correspond to the interval of matches to return.
cat
Returns empty list on any error.
Use this method to specify what annotations to make CQP to show. Pass it a list of the annotation names.
Use this method to specify what annotations to make CQP to not show (hide). Pass it a list of the annotation names.
Change current active corpus. Pass the corpus name as the argument.
Set CQP properties. Pass a hash (not a reference) of key/values to be set. Note that at the moment string values should be double quoted (see example in the synopsis).
Similar to CWB::CQP->exec, but dying in case of error with the error message. Useful for use with Try::Tiny. Check the synopsis above for an example.
Try::Tiny
Returns a reference to a hash with details about a specific corpus, like name, id, home directory, properties and attributes;
Returns a reference to a list of the available corpora;
Returns a new iterator, to iterate over a result set. See CWB::CQP::More::Iterator for documentation on how to use it.
Alberto Simoes, <ambs at cpan.org>
<ambs at cpan.org>
Please report any bugs or feature requests to bug-cwb-cqp-more at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CWB-CQP-More. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-cwb-cqp-more at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc CWB::CQP::More
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=CWB-CQP-More
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/CWB-CQP-More
CPAN Ratings
http://cpanratings.perl.org/d/CWB-CQP-More
Search CPAN
http://search.cpan.org/dist/CWB-CQP-More/
Thanks for Stefan Evert for all help.
Copyright 2010-2011 Alberto Simoes.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install CWB::CQP::More, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CWB::CQP::More
CPAN shell
perl -MCPAN -e shell install CWB::CQP::More
For more information on module installation, please visit the detailed CPAN module installation guide.