DTA::CAB::Analyzer::Dict::CDB - generic analysis dictionary API using Lingua::TT::CDBFile
##========================================================================
## PRELIMINARIES
use DTA::CAB::Analyzer::Dict::CDB;
##========================================================================
## Constructors etc.
$obj = CLASS_OR_OBJ->new(%args);
$dic = $dic->clear();
##========================================================================
## Methods: Embedded API
$bool = $dic->dictOk();
\%key2val = $dict->dictHash();
$val_or_undef = $dict->dictLookup($key);
##========================================================================
## Methods: I/O
$bool = $dic->ensureLoaded();
##========================================================================
## Methods: Persistence: Perl
@keys = $class_or_obj->noSaveKeys();
$loadedObj = $CLASS_OR_OBJ->loadPerlRef($ref);
DTA::CAB::Analyzer::Dict::CDB inherits from DTA::CAB::Analyzer::Dict and supports the DTA::CAB::Analyzer API. This module uses Lingua::TT::CDBFile to implement a static finite dictionary stored in a CDB file.
$obj = CLASS_OR_OBJ->new(%args);
%$obj, %args:
##-- Filename Options
dictFile => $filename, ##-- DB filename (default=undef)
##
##-- Analysis Output
label => $lab, ##-- analyzer label
analyzeCode => $code, ##-- pseudo-accessor code for analyzeing token $_
##
##-- Analysis Options
encoding => $enc, ##-- encoding of db file (default='UTF-8'): clobbers $dba{encoding}
##
##-- Analysis objects
dbf => $dbf, ##-- underlying Lingua::TT::CDBFile object (default=undef)
dba => \%dba, ##-- args for Lingua::TT::CDBFile->new()
#={
# mode => $mode, ##-- default: 0644
# dbflags => $flags, ##-- default: O_RDONLY
# type => $type, ##-- one of 'HASH', 'BTREE', 'RECNO', 'GUESS' (default: 'GUESS')
# dbinfo => \%dbinfo, ##-- default: "DB_File::${type}INFO"->new();
# dbopts => \%opts, ##-- db options (e.g. cachesize,bval,...) -- defaults to none (uses DB_File defaults)
# }
$dic = $dic->clear();
Overriude just closes db.
$bool = $dic->dictOk();
Should returns false iff dict is undefined or "empty". Override just checks whether the underlying DB file has been successfully opened.
\%key2val = $dict->dictHash();
Returns a (possibly tie()d hash) representing dict contents. Override returns $dict->{dbf}{data} or a new empty hash.
$val_or_undef = $dict->dictLookup($key);
Get stored value for key $key, if any. Default returns $dict->{ttd}{dict}{$key} or undef.
$bool = $dic->ensureLoaded();
Ensures analyzer data is loaded from default files. Override instantiates $dic->{dbf} as a new Lingua::TT::CDBFile object.
@keys = $class_or_obj->noSaveKeys();
Returns list of keys not to be saved. Default adds qw(dbf) to superclass list.
$loadedObj = $CLASS_OR_OBJ->loadPerlRef($ref);
Load object data from a perl reference. Probably a dangerous thing to do on an open DB.
Bryan Jurish <moocow@cpan.org>
Copyright (C) 2011-2019 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.24.1 or, at your option, any later version of Perl 5 you may have available.
dta-cab-analyze.perl(1), DTA::CAB::Analyzer::Dict(3pm), DTA::CAB::Analyzer(3pm), DTA::CAB::Chain(3pm), DTA::CAB(3pm), perl(1), ...