Algorithm-CRF

 view release on metacpan or  search on metacpan

common.h  view on Meta::CPAN

uitoa(_n, buf); \
append(buf); \
return *this; } while (0)

#define _DTOA(_n) do { \
char buf[64]; \
dtoa(_n, buf); \
append(buf); \
return *this; } while (0)

  class string_buffer: public std::string {
  public:
    string_buffer& operator<<(double _n)             { _DTOA(_n); }
    string_buffer& operator<<(short int _n)          { _ITOA(_n); }
    string_buffer& operator<<(int _n)                { _ITOA(_n); }
    string_buffer& operator<<(long int _n)           { _ITOA(_n); }
    string_buffer& operator<<(unsigned short int _n) { _UITOA(_n); }
    string_buffer& operator<<(unsigned int _n)       { _UITOA(_n); }
    string_buffer& operator<<(unsigned long int _n)  { _UITOA(_n); }
    string_buffer& operator<<(char _n) {
      push_back(_n);
      return *this;

common.h  view on Meta::CPAN

      append(_n);
      return *this;
    }
    string_buffer& operator<<(const std::string& _n) {
      append(_n);
      return *this;
    }
  };

  class die {
  public:
    die() {}
    virtual ~die() {
      std::cerr << std::endl;
      exit(-1);
    }
    int operator&(std::ostream&) { return 0; }
  };

  class warn {
  public:
    warn() {}
    virtual ~warn() { std::cerr << std::endl; }
    int operator&(std::ostream&) { return 0; }
  };

  struct whatlog {
    std::ostrstream stream_;
    const char *str() {
      stream_ << std::ends;
      return stream_.str();
    }
    jmp_buf cond_;
  };

  class wlog {
  public:
    whatlog *l_;
    explicit wlog(whatlog *l): l_(l) { l_->stream_.clear(); }
    ~wlog() { longjmp(l_->cond_, 1); }
    int operator&(std::ostream &) { return 0; }
  };
}

#define WHAT what_.stream_

#define CHECK_RETURN(condition, value) \

encoder.h  view on Meta::CPAN

//
#ifndef _CRFPP_LEANER_H
#define _CRFPP_LEANER_H

#include "common.h"

namespace CRFPP {
  class Encoder {
  private:
    whatlog what_;
  public:
    enum { CRF, MIRA };
    bool learn(const char *, const char *, const char *, bool, size_t, size_t,
               double, double, unsigned short, unsigned short, int);
    bool convert(const char *, const char*);
    const char* what() { return what_.str(); }
  };
}
#endif

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

use 5.008008;
use strict;
use warnings;

require Exporter;

our @ISA = qw(Exporter);

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.

# This allows declaration	use Algorithm::CRF ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
	
) ] );

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

t/test.data  view on Meta::CPAN

savings NNS I
. . O

He PRP B
left VBD O
his PRP$ B
last JJ I
two CD I
jobs NNS I
at IN O
Republic NNP B
Airlines NNPS I
and CC O
Flying NNP B
Tiger NNP I
with IN O
combined VBN B
stock-option NN I
gains NNS I
of IN O
about RB B

t/test.data  view on Meta::CPAN

his PRP$ B
most RBS I
outspoken JJ I
political JJ I
opponent NN I
and CC O
the DT B
first JJ I
man NN I
to TO O
publicly RB O
finger NN O
Mr. NNP B
Noriega NNP I
on IN O
drug NN B
trafficking NN I
charges NNS I
. . O

He PRP B

t/test.data  view on Meta::CPAN

pain NN I
and CC O
constantly RB O
improved VBN O
health NN B
and CC I
well-being NN I
. . O

Most JJS B
public-health JJ I
measures NNS I
were VBD O
handled VBN O
at IN O
the DT B
local JJ I
level NN I
. . O

New NNP B
Environmentalism NNP I
probably RB O
started VBD O
in IN O
1962 CD B
with IN O
the DT B
publication NN I
of IN O
Rachel NNP B
Carson NNP I
's POS B
book NN I
`` `` O
Silent NNP B
Spring NNP I
. . O
'' '' O

t/test.data  view on Meta::CPAN

If IN O
the DT B
media NNS I
decide VBP O
to TO O
work VB O
harder JJR O
at IN O
educating VBG O
the DT B
public NN I
about IN O
these DT B
complex JJ I
and CC I
technical JJ I
issues NNS I
, , O
that IN B
hardly RB O
can MD O

t/test.data  view on Meta::CPAN

areas NNS I
. . O

Environmentalists NNS B
criticized VBD O
the DT B
program NN I
as IN O
merely RB B
a DT I
public-relations NNS I
attempt VBP I
to TO O
head VB O
off IN O
a DT B
White NNP I
House NNP I
proposal NN I
to TO O
require VB O

t/test.data  view on Meta::CPAN

asserting VBG O
a DT B
right NN I
, , O
as IN O
taxpayers NNS B
, , O
to TO O
pedal VB O
on IN O
public JJ B
lands NNS I
. . O

But CC O
the DT B
bikes NNS I
' POS B
burgeoning VBG I
numbers NNS I
, , O

t/test.data  view on Meta::CPAN

nightmare NN I
for IN O
unsuspecting JJ B
hikers NNS I
or CC I
equestrians NNS I
. . O

For IN O
harried VBN B
public-land JJ I
managers NNS I
across IN O
the DT B
nation NN I
, , O
the DT B
response NN I
is VBZ O
increasingly RB O
to TO O

t/test.data  view on Meta::CPAN

off-road JJ I
vehicles NNS I
. . O

But CC O
the DT B
club NN I
still RB O
insists VBZ O
that IN O
public JJ B
lands NNS I
ought MD O
to TO O
be VB O
closed VBN O
to TO O
the DT B
bikes NNS I
unless IN O
studies NNS B



( run in 0.494 second using v1.01-cache-2.11-cpan-64827b87656 )