The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Moot::HMM - libmoot : HMM

SYNOPSIS

  use Moot;

  ##=====================================================================
  ## Constructors etc
 
  $hmm  = Moot::HMM->new(\%opts);
  $opts = $hmm->config(\%opts);
  $opts = $hmm->config();

  ##=====================================================================
  ## Accessors
  ##  + all of the following are get/set methods, e.g.
  ##    `$hmm->verbose()' gets the value of the 'verbose' property, and
  ##    `$hmm->verbose($i)' sets it
 
  $val = $hmm->verbose();
  $ndots = $hmm->ndots();
 
  $save_ambiguities = $hmm->save_ambiguities();
  $save_flavors = $hmm->save_flavors();
  $save_mark_unknown = $hmm->save_mark_unknown();
 
  $hash_ngrams = $hmm->hash_ngrams();
  $relax = $hmm->relax();
  $use_lex_classes = $hmm->use_lex_classes();
 
  $start_tagid = $hmm->start_tagid();
 
  $unknown_lex_threshhold = $hmm->unknown_lex_threshhold();
  $unknown_class_threshhold = $hmm->unknown_class_threshhold();
 
  $nglambda1 = $hmm->nglambda1();
  $nglambda2 = $hmm->nglambda2();
  $nglambda3 = $hmm->nglambda3();
 
  $wlambda0 = $hmm->wlambda0();
  $wlambda1 = $hmm->wlambda1();
 
  $clambda0 = $hmm->clambda0();
  $clambda1 = $hmm->clambda1();
 
  $beamwd = $hmm->beamwd();
 
  $nsents = $hmm->nsents();
  $ntokens = $hmm->ntokens();
  $nnewtokens = $hmm->nnewtokens();
  $nunclassed = $hmm->nunclassed();
  $nnewclasses = $hmm->nnewclasses();
  $nunknown = $hmm->nunknown();
  $nfallbacks = $hmm->nfallbacks();

  ##=====================================================================
  ## Low-Level Lookup
 
  $logp = $hmm->wordp($word, $tag);          ##-- log p($word|$tag)
 
  $logp = $hmm->classp(\@tagset, $tag);      ##-- log p(\@tagset|$tag)
 
  $logp = $hmm->tagp($tag1);                 ##-- log p($tag1)              : raw
  $logp = $hmm->tagp($tag1,$tag2);           ##-- log p($tag2|$tag1)        : raw
  $logp = $hmm->tagp($tag1,$tag2,$tag3);     ##-- log p($tag3|$tag1,$tag2)  : raw?

  ##=====================================================================
  ## Tagging
 
  ## sentences are tagged in-place; structure:
  @sent = (
           {text=>'This'},
           {text=>'is',    tag=>'this_will_be_overwritten'},
           {text=>'a'      tag=>'this_too'},
           {text=>'test',  analyses=>[{tag=>'N',details=>'test/N'},
                                      {tag=>'V',details=>'test/V',prob=>42}] },
           {text=>'.'      analyses=>[{tag=>'$.'}]},
          );
 
  $hmm->tag_sentence(\@sent,$utf8=1,$trace=0);  ##-- clobbers 'tag' key of each token hash
 
  $hmm->tag_io    ( $reader, $writer );         ##-- sentence-stream tagging
  $hmm->tag_stream( $reader, $writer );         ##-- token-stream tagging

  ##=====================================================================
  ## I/O
 
  $hmm = $CLASS_OR_OBJECT->load($model);
  $hmm = $CLASS_OR_OBJECT->loadBin($binfile);
 
  $bool = $hmm->saveBin($binfile, $zlevel=-1);
  undef = $hmm->txtdump($filename='-');

DESCRIPTION

The Moot module provides an object-oriented interface to the libmoot library for Hidden Markov Model part-of-speech tagging.

SEE ALSO

Moot(3perl), Moot::Constants(3perl), moot(1), perl(1).

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2011-2013 by Bryan Jurish

This library 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.