Lingua::LangId::Map - language identification utilities: language classifier |
Lingua::LangId::Map - language identification utilities: language classifier
##======================================================================== ## PRELIMINARIES
use Lingua::LangId::Map;
##======================================================================== ## Constructors etc.
$map = $CLASS_OR_OBJECT->new(%opts); @noShadowKeys = $obj->noShadowKeys();
##======================================================================== ## Methods: Compilation
$map_or_undef = $map->compile(); $map = $map->addSig($sig);
##======================================================================== ## Methods: Testing
$sig = $map->newSig(%opts); \%rh = $map->applyFile($filename_or_fh,%opts); \%rh = $map->applyString($str,%opts); \%rh = $map->applySig($sig2); \%rh = $sig->apply(file=>$filename_or_fh,%opts);
Lingua::LangId::Map inherits from Lingua::LangId::Object.
$map = $CLASS_OR_OBJECT->new(%opts);
%opts, %$sig:
sigs => \%label2sig, ##-- each $sig also has a key 'label' template => $sig, ##-- template for creating new sigs (default: undef) ## + if undef, first sig added with addSig() will be shadowed & used #...
@noShadowKeys = $obj->noShadowKeys();
Returns list of keys not to be passed to $CLASS->new()
on shadow()
.
Override returns qw(sigs).
$map_or_undef = $map->compile();
Compiles all sub-signatures
$map = $map->addSig($sig); $map = $map->addSig($sig,%opts)
%opts:
label=>$label
Add signature $sig to map inventory with label $label. Sets $sig->{label}. Default label is "$sig".
$sig = $map->newSig(%opts);
New signature from $map->{template}
%opts are passed to Lingua::LangId::Signature->new()
.
\%rh = $map->applyFile($filename_or_fh,%opts);
Trains new signature from $file and applies.
%opts are passed to Lingua::LangId::Signature->new()
.
\%rh = $map->applyString($str,%opts); \%rh = $map->applyString(\$str,%opts)
Trains new signature from $file and applies
\%rh = $map->applySig($sig2);
Compares $sig vs. each signature in $map->{sigs} Result-hash %rh is:
$sigName => \%sig_rh, ... ##-- for each $sigName in $map->{sigs}
Each %sig_rh is:
kld => $raw_kld, ##-- raw comparison klde => $expected_kld, ##-- expected KLD for $sig2->N kldp => $kld_p, ##-- comparison p-value as returned by $sig->kldp($sig2) match => $bool, ##-- true iff $kldp >= $sig->{cutoff}
\%rh = $sig->apply(file=>$filename_or_fh,%opts); \%rh = $sig->apply(str=>$string_or_ref,%opts); \%rh = $sig->apply(sig=>$sig,%opts);
Lingua::LangId(3pm)
Bryan Jurish <jurish@uni-potsdam.de>
Copyright (C) 2009 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.8.4 or, at your option, any later version of Perl 5 you may have available.
Lingua::LangId::Map - language identification utilities: language classifier |