Sha256: d374026f23b7cb92605a8ce6752dbdc904d83eab57fb1a997ffc50fb68f51136

Contents?: true

Size: 795 Bytes

Versions: 3

Compression:

Stored size: 795 Bytes

Contents

#include <PA.h>

#include <rice/Module.hpp>

#include "utils.h"

void init_pa(Rice::Module& m) {
  Rice::define_class_under<tomoto::IPAModel, tomoto::ILDAModel>(m, "PA")
    .define_singleton_method(
      "_new",
      *[](size_t tw, size_t k1, size_t k2, tomoto::Float alpha, tomoto::Float eta, size_t seed) {
        tomoto::PAArgs args;
        args.k = k1;
        args.k2 = k2;
        args.alpha = {alpha};
        args.eta = eta;
        if (seed >= 0) {
          args.seed = seed;
        }
        return tomoto::IPAModel::create((tomoto::TermWeight)tw, args);
      })
    .define_method(
      "k1",
      *[](tomoto::IPAModel& self) {
        return self.getK();
      })
    .define_method(
      "k2",
      *[](tomoto::IPAModel& self) {
        return self.getK2();
      });
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tomoto-0.2.2 ext/tomoto/pa.cpp
tomoto-0.2.1 ext/tomoto/pa.cpp
tomoto-0.2.0 ext/tomoto/pa.cpp