Sha256: ee21e6781d540968692b3e11cc956da434506fc08ece9bc20cae1dca7984f6b4

Contents?: true

Size: 1017 Bytes

Versions: 25

Compression:

Stored size: 1017 Bytes

Contents

#include <PLDA.h>

#include <rice/rice.hpp>

#include "utils.h"

void init_plda(Rice::Module& m) {
  Rice::define_class_under<tomoto::IPLDAModel, tomoto::ILLDAModel>(m, "PLDA")
    .define_singleton_function(
      "_new",
      [](size_t tw, size_t latent_topics, tomoto::Float alpha, tomoto::Float eta, size_t seed) {
        tomoto::PLDAArgs args;
        args.numLatentTopics = latent_topics;
        args.alpha = {alpha};
        args.eta = eta;
        if (seed >= 0) {
          args.seed = seed;
        }
        return tomoto::IPLDAModel::create((tomoto::TermWeight)tw, args);
      }, Rice::Return().takeOwnership())
    .define_method(
      "_add_doc",
      [](tomoto::IPLDAModel& self, std::vector<std::string> words, std::vector<std::string> labels) {
        auto doc = buildDoc(words);
        doc.misc["labels"] = labels;
        return self.addDoc(doc);
      })
    .define_method(
      "latent_topics",
      [](tomoto::IPLDAModel& self) {
        return self.getNumLatentTopics();
      });
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
tomoto-0.4.1-x86_64-linux ext/tomoto/plda.cpp
tomoto-0.4.1-x86_64-darwin ext/tomoto/plda.cpp
tomoto-0.4.1-arm64-darwin ext/tomoto/plda.cpp
tomoto-0.4.1-aarch64-linux ext/tomoto/plda.cpp
tomoto-0.4.1 ext/tomoto/plda.cpp
tomoto-0.4.0-x86_64-linux ext/tomoto/plda.cpp
tomoto-0.4.0-x86_64-darwin ext/tomoto/plda.cpp
tomoto-0.4.0-arm64-darwin ext/tomoto/plda.cpp
tomoto-0.4.0-aarch64-linux ext/tomoto/plda.cpp
tomoto-0.4.0 ext/tomoto/plda.cpp
tomoto-0.3.3-x86_64-linux ext/tomoto/plda.cpp
tomoto-0.3.3-x86_64-darwin ext/tomoto/plda.cpp
tomoto-0.3.3-arm64-darwin ext/tomoto/plda.cpp
tomoto-0.3.3 ext/tomoto/plda.cpp
tomoto-0.3.2-x86_64-linux ext/tomoto/plda.cpp
tomoto-0.3.2-x86_64-darwin ext/tomoto/plda.cpp
tomoto-0.3.2-arm64-darwin ext/tomoto/plda.cpp
tomoto-0.3.2 ext/tomoto/plda.cpp
tomoto-0.3.1-x86_64-linux ext/tomoto/plda.cpp
tomoto-0.3.1-x86_64-darwin ext/tomoto/plda.cpp