Sha256: 0524ec6fe4e4b724a6bde968cd772ea59f73916bb3270827cd0178fcfa7beca1

Contents?: true

Size: 982 Bytes

Versions: 11

Compression:

Stored size: 982 Bytes

Contents

#include <LLDA.h>

#include <rice/rice.hpp>

#include "utils.h"

void init_llda(Rice::Module& m) {
  Rice::define_class_under<tomoto::ILLDAModel, tomoto::ILDAModel>(m, "LLDA")
    .define_singleton_function(
      "_new",
      [](size_t tw, size_t k, tomoto::Float alpha, tomoto::Float eta, size_t seed) {
        tomoto::LDAArgs args;
        args.k = k;
        args.alpha = {alpha};
        args.eta = eta;
        if (seed >= 0) {
          args.seed = seed;
        }
        return tomoto::ILLDAModel::create((tomoto::TermWeight)tw, args);
      }, Rice::Return().takeOwnership())
    .define_method(
      "_add_doc",
      [](tomoto::ILLDAModel& 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(
      "topics_per_label",
      [](tomoto::ILLDAModel& self) {
        return self.getNumTopicsPerLabel();
      });
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tomoto-0.3.2-x86_64-linux ext/tomoto/llda.cpp
tomoto-0.3.2-x86_64-darwin ext/tomoto/llda.cpp
tomoto-0.3.2-arm64-darwin ext/tomoto/llda.cpp
tomoto-0.3.2 ext/tomoto/llda.cpp
tomoto-0.3.1-x86_64-linux ext/tomoto/llda.cpp
tomoto-0.3.1-x86_64-darwin ext/tomoto/llda.cpp
tomoto-0.3.1 ext/tomoto/llda.cpp
tomoto-0.3.0-x86_64-linux ext/tomoto/llda.cpp
tomoto-0.3.0-x86_64-darwin ext/tomoto/llda.cpp
tomoto-0.3.0 ext/tomoto/llda.cpp
tomoto-0.2.3 ext/tomoto/llda.cpp