NAME

DiaColloDB::Corpus - diachronic collocation db, source corpous

SYNOPSIS

##========================================================================
## PRELIMINARIES

use DiaColloDB::Corpus;

##========================================================================
## Constructors etc.

$corpus = CLASS_OR_OBJECT->new(%args);

##========================================================================
## API: open/close

$bool = $corpus->open(\@ARGV, %opts);
$bool = $corpus->close();

##========================================================================
## API: iteration

$nfiles = $corpus->size();
undef = $corpus->ibegin();
$bool = $corpus->iok();
$label = $corpus->ifile();
$doc_or_undef = $corpus->idocument();
$pos = $corpus->inext();
$pos = $corpus->icur();

DESCRIPTION

Globals & Constants

Variable: @ISA

DiaColloDB::Corpus inherits from DiaColloDB::Logger.

Variable: $DCLASS_DEFAULT

Default document subclass; default = 'DDCTabs'.

Constructors etc.

new
$corpus = CLASS_OR_OBJECT->new(%args);

%args, object structure:

files => \@files,   ##-- source files
dclass => $dclass,  ##-- DiaColloDB::Document subclass for loading (default=$DCLASS_DEFAULT)
dopts  => \%opts,   ##-- options for $dclass->fromFile()
cur    => $i,       ##-- index of current file

API: open/close

open
$bool = $corpus->open(\@ARGV, %opts);

Open a corpus. %opts:

glob => $bool,     ##-- whether to glob arguments
list => $bool,     ##-- whether arguments are file-lists
close
$bool = $corpus->close();

Close corpus.

API: iteration

size
$nfiles = $corpus->size();

Get number of files in corpus.

ibegin
undef = $corpus->ibegin();

reset iterator

iok
$bool = $corpus->iok();

true if iterator is valid

ifile
$label = $corpus->ifile();
$label = $corpus->ifile($pos);

gets current iterator label (1st form) or label for document at $pos (2nd form).

idocument
$doc_or_undef = $corpus->idocument();
$doc_or_undef = $corpus->idocument($pos);

gets current document (1st form), or document at $pos (2nd form).

inext
$pos = $corpus->inext();

increment iterator

icur
$pos = $corpus->icur();

returns current position

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2015-2020 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.

SEE ALSO

DiaColloDB::Corpus::Compiled(3pm), DiaColloDB::Document(3pm), DiaColloDB(3pm), perl(1), ...