CWB::CQP::More::Iterator - Iterator for CWB::CQP resultsets
use CWB::CQP::More; my $cwb = CWB::CQP::More->new(); $cwb->change_corpus("foo"); $cwb->exec('A = "dog";'); my $iterator = $cwb->iterator("A"); my $next_line = $iterator->next; my $iterator20 = $cwb->iterator("A", size => 20); my @twenty = $iterator20->next; my $iteratorFoo = $cwb->iterator("A", size => 20, corpus => 'foo'); my @lines = $iteratorFoo->next; $iterator->reset; $iterator->increment(20);
This module implements an interator for CWB result sets. Please to not use the constructor directly. Instead, use the iterator method on CWB::CQP::More module.
iterator
CWB::CQP::More
new
Creates a new iterator. Used internally by the CWB::CQP::More module, when the method iterator is called.
next
Returns the next line(s) on the result set.
reset
Restarts the iterator.
peek
Use peek to peek the iterator. Pass it a offset (positive or negative). It will return the concordance at that position. Note that the current iterator position is not changed!
my $peek = $cwb->peek(100); # look 100 positions ahead my $backpeek = $cwb->peek(-100); # look 100 positions behind
increment
Without arguments returns the current iterator increment size (number of lines returned by iteraction). With an argument, changes the size of the increment. The increment size can be changed while using the iterator.
forward
Forwards the iterator the offset specified. If the offset is too big (as in, more iterations than the size of the iterator) the iterator is set to the last element. It also supports negative offsets (but please use the backward method).
backward
The new position index is returned.
Backwards the iterator the offset specified. If the offset is too big (as in, more iterations than the current position of the iterator) the iterator is set to the first element. It also supports negative offsets (but please use the forward method).
CWB::CQP::More (3), perl(1)
Alberto Manuel Brandão Simões, <ambs@cpan.org>
Copyright (C) 2010 by Alberto Manuel Brandão Simões
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.