NAME

DTA::CAB::Analyzer::Dyn - generic analyzer API: dynamic code generation

SYNOPSIS

use DTA::CAB::Analyzer::Dyn;

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

$obj = CLASS_OR_OBJ->new(%args);
undef = $anl->dropClosures();

##========================================================================
## Methods: I/O

$bool = $anl->prepare();

##========================================================================
## Methods: Dynamic Closures

$bool = $anl->ensureDynSubs();
\&sub = $anl->compileDynSub($which);
$code = $anl->dynSubCode($which);
undef = dumpPackage(%opts);

##========================================================================
## Methods: Analysis: API: Dyn

$rc = $anl->analyzeDyn($which,@args);

##========================================================================
## Methods: Analysis: API

$doc = $anl->analyzeDocument($doc,\%opts);
$doc = $anl->analyzeTypes($doc,\%types,\%opts);
$doc = $anl->analyzeTokens($doc,\%opts);
$doc = $anl->analyzeSentences($doc,\%opts);
$doc = $anl->analyzeLocal($doc,\%opts);
$doc = $anl->analyzeClean($doc,\%opts);

DESCRIPTION

UNMAINTAINED

This module provides a DTA::CAB::Analyzer subclass using dynamically generated closures to implement the DTA::CAB::Analyzer analysis API. In theory, this should be faster than on-the-fly compilation of accessor strings, etc, but is a serious pain in the posterior to debug.

Globals

Variable: @ISA

(undocumented)

Constructors etc.

new
$obj = CLASS_OR_OBJ->new(%args);

object structure, new

(
 ##-- code generation options
 analyze${Which}Code => $str,  ##-- code for analyze${Which} method
 ##-- generated code
 analyze${Which}Sub => \&sub,  ##-- compiled code for analyze${Which} method
)
dropClosures
undef = $anl->dropClosures();
  • drops 'analyze${which}' closures

  • currently does nothing

Methods: I/O: Input: all

prepare
$bool = $anl->prepare();
$bool = $anl->prepare(\%opts)
  • inherited: wrapper for ensureLoaded(), autoEnable(), initInfo()

  • override appends ensureDynSubs() call

Methods: Dynamic Closures

ensureDynSubs
$bool = $anl->ensureDynSubs();

ensures subs are defined for all analyze${Which} methods

compileDynSub
\&sub = $anl->compileDynSub($which);

returns compiled analyze${Which} sub

dynSubCode
$code = $anl->dynSubCode($which);

returns code for analyze${Which} sub

dumpPackage
undef = dumpPackage(%opts);

%opts:

file => $file_or_handle,
package => $pkgname,

Methods: Analysis: API: Dyn

analyzeDyn
$rc = $anl->analyzeDyn($which,@args);

wrapper for $anl->{"analyze${which}"}->(@args)

Methods: Analysis: API

analyzeDocument
$doc = $anl->analyzeDocument($doc,\%opts);

analyze a DTA::CAB::Document $doc

analyzeTypes
$doc = $anl->analyzeTypes($doc,\%types,\%opts);

perform type-wise analysis of all (text) types in $doc->{types}

analyzeTokens
$doc = $anl->analyzeTokens($doc,\%opts);

perform token-wise analysis of all tokens $doc->{body}[$si]{tokens}[$wi]

analyzeSentences
$doc = $anl->analyzeSentences($doc,\%opts);

perform sentence-wise analysis of all sentences $doc->{body}[$si]

analyzeLocal
$doc = $anl->analyzeLocal($doc,\%opts);

perform analyzer-local document-level analysis of $doc

analyzeClean
$doc = $anl->analyzeClean($doc,\%opts);

cleanup any temporary data associated with $doc

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

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.

SEE ALSO

dta-cab-analyze.perl(1), DTA::CAB::Analyzer(3pm), DTA::CAB::Chain(3pm), DTA::CAB(3pm), perl(1), ...