Algorithm-Viterbi

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

            This state can also be used as a separator between the beginning
            and end of a sequence of observations. For example, you could
            assign this state (tag) to every end-of-sentence symbol when
            training on a pre-tagged corpus.

            The set of observations is passed as a reference to an array as
            shown in the following example:

              use strict;
              use Algorithm::Viterbi;
              use Data::Dumper;

              my $observations = [
                [ 'work', 'rainy' ],
                [ 'work', 'sunny' ],
                [ 'walk', 'sunny' ],
                [ 'walk', 'rainy' ],
                [ 'shop', 'rainy' ],
                [ 'work', 'rainy' ],
              ];

README  view on Meta::CPAN


            The difference with the algorithm described in the web page
            above, is that the emission and the transition are calculated
            somewhat differently. See methods get_emission and
            get_transition.

            Example:

              use strict;
              use Algorithm::Viterbi;
              use Data::Dumper;

              my $observations = [ 'walk', 'shop', 'clean' ];
               my $start = { 'Rainy'=> 0.6, 'Sunny'=> 0.4 };
               my $transition = {
                  'Rainy' => {'Rainy'=> 0.7, 'Sunny'=> 0.3},
                  'Sunny' => {'Rainy'=> 0.4, 'Sunny'=> 0.6},
                  };

              my $emission = {
                'shop' => {

lib/Algorithm/Viterbi.pm  view on Meta::CPAN

or later by accessing the member directly. See example below.

This state can also be used as a separator between the beginning and end of a sequence of observations. 
For example, you could assign this state (tag) to every end-of-sentence symbol when training on a 
pre-tagged corpus.

The set of observations is passed as a reference to an array as shown in the following example:

  use strict;
  use Algorithm::Viterbi;
  use Data::Dumper;

  my $observations = [
    [ 'work', 'rainy' ],
    [ 'work', 'sunny' ],
    [ 'walk', 'sunny' ],
    [ 'walk', 'rainy' ],
    [ 'shop', 'rainy' ],
    [ 'work', 'rainy' ],
  ];

lib/Algorithm/Viterbi.pm  view on Meta::CPAN

L<http://en.wikipedia.org/wiki/Viterbi_algorithm>.

The difference with the algorithm described in the web page above, 
is that the emission and the transition are calculated somewhat
differently. See methods get_emission and get_transition.

Example:

  use strict;
  use Algorithm::Viterbi;
  use Data::Dumper;

    
  my $observations = [ 'walk', 'shop', 'clean' ];
   my $start = { 'Rainy'=> 0.6, 'Sunny'=> 0.4 };
   my $transition = {
      'Rainy' => {'Rainy'=> 0.7, 'Sunny'=> 0.3},
      'Sunny' => {'Rainy'=> 0.4, 'Sunny'=> 0.6},
      };

  my $emission = {



( run in 0.918 second using v1.01-cache-2.11-cpan-a5abf4f5562 )