Sha256: f130aabb92f979bcd89a4a2b38b2d6322603f3fce717301f6e22c6cd90f43c14

Contents?: true

Size: 824 Bytes

Versions: 25

Compression:

Stored size: 824 Bytes

Contents

#include <PA.h>

#include <rice/rice.hpp>

#include "utils.h"

void init_pa(Rice::Module& m) {
  Rice::define_class_under<tomoto::IPAModel, tomoto::ILDAModel>(m, "PA")
    .define_singleton_function(
      "_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);
      }, Rice::Return().takeOwnership())
    .define_method(
      "k1",
      [](tomoto::IPAModel& self) {
        return self.getK();
      })
    .define_method(
      "k2",
      [](tomoto::IPAModel& self) {
        return self.getK2();
      });
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
tomoto-0.3.1 ext/tomoto/pa.cpp
tomoto-0.3.0-x86_64-linux ext/tomoto/pa.cpp
tomoto-0.3.0-x86_64-darwin ext/tomoto/pa.cpp
tomoto-0.3.0 ext/tomoto/pa.cpp
tomoto-0.2.3 ext/tomoto/pa.cpp