DTA::CAB::Analyzer::Automaton::Dyn - generic analysis automaton API
use DTA::CAB::Analyzer::Automaton::Dyn;
##========================================================================
## Constructors etc.
$obj = CLASS_OR_OBJ->new(%args);
$aut = $aut->clear();
##========================================================================
## Methods: Generic
$class = $aut->fstClass();
$class = $aut->labClass();
$bool = $aut->fstOk();
$bool = $aut->labOk();
$bool = $aut->dictOk();
##========================================================================
## Methods: I/O
$bool = $aut->ensureLoaded();
$aut = $aut->load(fst=>$fstFile, lab=>$labFile);
$aut = $aut->loadFst($fstfile);
$aut = $aut->loadLabels($labfile);
$aut = $aut->parseLabels();
$aut = $aut->loadDict($dictfile);
##========================================================================
## Methods: Persistence: Perl
@keys = $class_or_obj->noSaveKeys();
$loadedObj = $CLASS_OR_OBJ->loadPerlRef($ref);
##========================================================================
## Methods: Analysis
DTA::CAB::Analyzer::Automaton::Dyn inherits from DTA::CAB::Analyzer.
$aut = CLASS_OR_OBJ->new(%args);
Constuctor.
%args, %$aut:
##-- Filename Options
fstFile => $filename, ##-- default: none
labFile => $filename, ##-- default: none
dictFile=> $filename, ##-- default: none (clobbers $aut->{dict}{dictFile} if defined)
##
##-- Analysis Output
analysisClass => $class, ##-- default: none (ARRAY)
analyzeSrc => $key, ##-- source key for analysis (default: 'text')
analyzeDst => $key, ##-- token output key (default: from __PACKAGE__)
wantAnalysisLo => $bool, ##-- set to true to include 'lo' keys in analyses (default: true)
##
##-- Analysis Options
eow => $sym, ##-- EOW symbol for analysis FST
check_symbols => $bool, ##-- check for unknown symbols? (default=1)
labenc => $enc, ##-- encoding of labels file (default='auto': utf8 > latin1)
#dictenc => $enc, ##-- dictionary encoding (default='utf8') : prefer $aut->{dict}{encoding}
auto_connect => $bool, ##-- whether to call $result->_connect() after every lookup (default=0)
tolower => $bool, ##-- if true, all input words will be bashed to lower-case (default=0)
tolowerNI => $bool, ##-- if true, all non-initial characters of inputs will be lower-cased (default=0)
toupperI => $bool, ##-- if true, initial character will be upper-cased (default=0)
bashWS => $str, ##-- if defined, input whitespace will be bashed to '$str' (default='_')
attInput => $bool, ##-- if true, respect AT&T lextools-style escapes in input (default=0)
allowTextRegex => $re, ##-- if defined, only tokens with matching 'text' will be analyzed (default: none)
##
##-- Analysis objects
fst => $gfst, ##-- (child classes only) e.g. a Gfsm::Automaton::Dyn object (default=new)
lab => $lab, ##-- (child classes only) e.g. a Gfsm::Alphabet object (default=new)
labh => \%sym2lab, ##-- (?) label hash: $sym2lab{$labSym} = $labId;
laba => \@lab2sym, ##-- (?) label array: $lab2sym[$labId] = $labSym;
labc => \@chr2lab, ##-- (?)chr-label array: $chr2lab[ord($chr)] = $labId;, by unicode char number (e.g. unpack('U0U*'))
result=>$resultfst, ##-- (child classes only) e.g. result fst
dict => $dict, ##-- exception lexicon / static cache as DTA::CAB::Analyzer::Dict object
$aut = $aut->clear();
Clears the object.
$class = $aut->fstClass();
Returns default FST class for "loadFst"() method. Used by sub-classes.
$class = $aut->labClass();
Returns default alphabet class for "loadLabels"() method. Used by sub-classes.
$bool = $aut->fstOk();
Should return false iff fst is undefined or "empty".
$bool = $aut->labOk();
Should return false iff alphabet (label-set) is undefined or "empty".
$bool = $aut->dictOk();
Should return false iff dict is undefined or "empty".
$bool = $aut->ensureLoaded();
Ensures automaton data is loaded from default files.
$aut = $aut->load(fst=>$fstFile, lab=>$labFile, dict=>$dictFile);
Loads specified files.
$aut = $aut->loadFst($fstfile);
Loads automaton from $fstfile.
$aut = $aut->loadLabels($labfile);
Loads labels from $labfile.
$aut = $aut->parseLabels();
Parses some information from a (newly loaded) alphabet.
sets up $aut->{labh}, $aut->{laba}, $aut->{labc}
fixes encoding difficulties in $aut->{labh}, $aut->{laba}
$aut = $aut->loadDict($dictfile);
Loads dictionary from $dictfile.
@keys = $class_or_obj->noSaveKeys();
Returns list of keys not to be saved
This implementation returns:
qw(dict fst lab laba labc labh result)
$loadedObj = $CLASS_OR_OBJ->loadPerlRef($ref);
Implicitly calls $obj->clear()
$bool = $anl->canAnalyze();
Returns true if analyzer can perform its function (e.g. data is loaded & non-empty) This implementation just returns:
$anl->dictOk || ($anl->labOk && $anl->fstOk)
Bryan Jurish <moocow@cpan.org>
Copyright (C) 2009-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.
Hey! The above document had some coding errors, which are explained below:
=cut found outside a pod block. Skipping to next block.