tomoto 0.6.1-x86_64-linux → 0.6.2-x86_64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b680ef4cc26d8777f8bd285ffcd2149c7f99c43250e7178bb7e34d5722d21be
4
- data.tar.gz: 7b50a8486a9bb3b1725dd0b75122ec8c9ae350baf496300b2d507199d1a0ff2d
3
+ metadata.gz: 961deef7a8d1d338dc292a00e3a038d8fe78ca0366e3ca6a02852ffa56dd55b6
4
+ data.tar.gz: d89063de9b6295faf286bab77d0cc2985e6db9790b621cf978670fc26ee81485
5
5
  SHA512:
6
- metadata.gz: b7e0b43889c43db1310b6c403f1c050268f3e7a7e9bc3115b9689f1635a2e1f3495bc700aab3c7d4fbae80f6d03f650ef035a0278c71f34827404a699031bb94
7
- data.tar.gz: f75a0fab4ee72bed17aa8a8e1ab6458cf9e047068b2303f226c9e0cab7ccfafde18aa0db04eb2e0ae38c7ef836fe90c022271f706c01c8fe108cc87ee5e2fa1c
6
+ metadata.gz: f5e6811100a82d51880afe9de5fbe38e8d8b1b92a7d93a7f575c38e19c665e6503b0bca0cbbd2228b0ce209867cc9084bf05ae6683d231bb516be4276c5fac8a
7
+ data.tar.gz: 2a46c0a219c7af171eb3526e178652bedd834c47b3804df05eabda82db0e69617645d4289896c9bfe9f77bc5a31e29a1c01f4653fad5fb168c86e41df9b8e55a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.6.2 (2026-02-21)
2
+
3
+ - Updated tomoto to 0.14.0
4
+ - Fixed memory leak with `make_doc` method
5
+
1
6
  ## 0.6.1 (2026-01-01)
2
7
 
3
8
  - Added support for Ruby 4.0
data/ext/tomoto/ct.cpp CHANGED
@@ -16,7 +16,7 @@ void init_ct(Rice::Module& m) {
16
16
  if (seed >= 0) {
17
17
  args.seed = seed;
18
18
  }
19
- return tomoto::ICTModel::create((tomoto::TermWeight)tw, args);
19
+ return tomoto::ICTModel::create((tomoto::TermWeight)tw, args).release();
20
20
  }, Rice::Return().takeOwnership())
21
21
  .define_method(
22
22
  "_correlations",
data/ext/tomoto/dmr.cpp CHANGED
@@ -22,7 +22,7 @@ void init_dmr(Rice::Module& m) {
22
22
  if (seed >= 0) {
23
23
  args.seed = seed;
24
24
  }
25
- return tomoto::IDMRModel::create((tomoto::TermWeight)tw, args);
25
+ return tomoto::IDMRModel::create((tomoto::TermWeight)tw, args).release();
26
26
  }, Rice::Return().takeOwnership())
27
27
  .define_method(
28
28
  "_add_doc",
data/ext/tomoto/dt.cpp CHANGED
@@ -27,7 +27,7 @@ void init_dt(Rice::Module& m) {
27
27
  if (seed >= 0) {
28
28
  args.seed = seed;
29
29
  }
30
- return tomoto::IDTModel::create((tomoto::TermWeight)tw, args);
30
+ return tomoto::IDTModel::create((tomoto::TermWeight)tw, args).release();
31
31
  }, Rice::Return().takeOwnership())
32
32
  .define_method(
33
33
  "_add_doc",
@@ -19,25 +19,21 @@ end
19
19
  apple_clang = RbConfig::CONFIG["CC_VERSION_MESSAGE"] =~ /apple clang/i
20
20
 
21
21
  if apple_clang
22
- # silence rice warnings
23
- $CXXFLAGS += " -Wno-deprecated-declarations"
22
+ # silence tomoto warnings
23
+ $CXXFLAGS += " -Wno-switch -Wno-unqualified-std-cast-call -Wno-inconsistent-missing-override"
24
24
  else
25
25
  # silence eigen warnings
26
- $CXXFLAGS += " -Wno-ignored-attributes -Wno-deprecated-copy"
26
+ $CXXFLAGS += " -Wno-ignored-attributes"
27
27
  end
28
28
 
29
- # silence tomoto warnings
30
- $CXXFLAGS += " -Wno-unused-variable -Wno-switch -Wno-unqualified-std-cast-call"
31
-
32
29
  ext = File.expand_path(".", __dir__)
33
30
  tomoto = File.expand_path("../../vendor/tomotopy/src/TopicModel", __dir__)
34
31
  tomoto_utils = File.expand_path("../../vendor/tomotopy/src/Utils", __dir__)
35
32
  eigen = File.expand_path("../../vendor/eigen", __dir__)
36
33
  eigen_rand = File.expand_path("../../vendor/EigenRand", __dir__)
37
- variant = File.expand_path("../../vendor/variant/include", __dir__)
38
34
 
39
35
  $srcs = Dir["{#{ext},#{tomoto},#{tomoto_utils}}/*.cpp"]
40
- $INCFLAGS += " -I#{tomoto} -I#{eigen} -I#{eigen_rand} -I#{variant}"
36
+ $INCFLAGS += " -I#{tomoto} -I#{eigen} -I#{eigen_rand}"
41
37
  $VPATH << tomoto
42
38
  $VPATH << tomoto_utils
43
39
 
data/ext/tomoto/gdmr.cpp CHANGED
@@ -24,7 +24,7 @@ void init_gdmr(Rice::Module& m) {
24
24
  if (seed >= 0) {
25
25
  args.seed = seed;
26
26
  }
27
- return tomoto::IGDMRModel::create((tomoto::TermWeight)tw, args);
27
+ return tomoto::IGDMRModel::create((tomoto::TermWeight)tw, args).release();
28
28
  }, Rice::Return().takeOwnership())
29
29
  .define_method(
30
30
  "_add_doc",
data/ext/tomoto/hdp.cpp CHANGED
@@ -17,7 +17,7 @@ void init_hdp(Rice::Module& m) {
17
17
  if (seed >= 0) {
18
18
  args.seed = seed;
19
19
  }
20
- return tomoto::IHDPModel::create((tomoto::TermWeight)tw, args);
20
+ return tomoto::IHDPModel::create((tomoto::TermWeight)tw, args).release();
21
21
  }, Rice::Return().takeOwnership())
22
22
  .define_method(
23
23
  "alpha",
data/ext/tomoto/hlda.cpp CHANGED
@@ -17,7 +17,7 @@ void init_hlda(Rice::Module& m) {
17
17
  if (seed >= 0) {
18
18
  args.seed = seed;
19
19
  }
20
- return tomoto::IHLDAModel::create((tomoto::TermWeight)tw, args);
20
+ return tomoto::IHLDAModel::create((tomoto::TermWeight)tw, args).release();
21
21
  }, Rice::Return().takeOwnership())
22
22
  .define_method(
23
23
  "alpha",
data/ext/tomoto/hpa.cpp CHANGED
@@ -17,7 +17,7 @@ void init_hpa(Rice::Module& m) {
17
17
  if (seed >= 0) {
18
18
  args.seed = seed;
19
19
  }
20
- return tomoto::IHPAModel::create((tomoto::TermWeight)tw, false, args);
20
+ return tomoto::IHPAModel::create((tomoto::TermWeight)tw, false, args).release();
21
21
  }, Rice::Return().takeOwnership())
22
22
  .define_method(
23
23
  "alpha",
data/ext/tomoto/lda.cpp CHANGED
@@ -12,10 +12,36 @@
12
12
 
13
13
  class DocumentObject {
14
14
  public:
15
- DocumentObject(const tomoto::DocumentBase* _doc, const tomoto::ITopicModel* _tm) : doc{ _doc }, tm{ _tm } {}
15
+ DocumentObject(const tomoto::DocumentBase* _doc, const tomoto::ITopicModel* _tm, bool _owner = false) : doc{ _doc }, tm{ _tm }, owner{ _owner } {}
16
+
17
+ ~DocumentObject() {
18
+ if (owner && doc) {
19
+ delete doc;
20
+ doc = NULL;
21
+ }
22
+ }
23
+
24
+ // prevent copy
25
+ DocumentObject(const DocumentObject&) = delete;
26
+ DocumentObject& operator=(const DocumentObject&) = delete;
27
+
28
+ DocumentObject(DocumentObject&& other) noexcept {
29
+ *this = std::move(other);
30
+ }
31
+
32
+ DocumentObject& operator=(DocumentObject&& other) noexcept {
33
+ if (this != &other) {
34
+ doc = other.doc;
35
+ tm = other.tm;
36
+ owner = other.owner;
37
+ other.owner = false;
38
+ }
39
+ return *this;
40
+ }
16
41
 
17
42
  const tomoto::DocumentBase* doc;
18
43
  const tomoto::ITopicModel* tm;
44
+ bool owner;
19
45
  };
20
46
 
21
47
  void init_lda(Rice::Module& m) {
@@ -42,7 +68,7 @@ void init_lda(Rice::Module& m) {
42
68
  if (seed >= 0) {
43
69
  args.seed = seed;
44
70
  }
45
- return tomoto::ILDAModel::create((tomoto::TermWeight)tw, args);
71
+ return tomoto::ILDAModel::create((tomoto::TermWeight)tw, args).release();
46
72
  }, Rice::Return().takeOwnership())
47
73
  .define_method(
48
74
  "_add_doc",
@@ -52,7 +78,7 @@ void init_lda(Rice::Module& m) {
52
78
  .define_method(
53
79
  "_make_doc",
54
80
  [](tomoto::ILDAModel& self, std::vector<std::string> words) {
55
- return DocumentObject(self.makeDoc(buildDoc(words)).release(), &self);
81
+ return DocumentObject(self.makeDoc(buildDoc(words)).release(), &self, true);
56
82
  })
57
83
  .define_method(
58
84
  "_infer",
data/ext/tomoto/llda.cpp CHANGED
@@ -20,7 +20,7 @@ void init_llda(Rice::Module& m) {
20
20
  if (seed >= 0) {
21
21
  args.seed = seed;
22
22
  }
23
- return tomoto::ILLDAModel::create((tomoto::TermWeight)tw, args);
23
+ return tomoto::ILLDAModel::create((tomoto::TermWeight)tw, args).release();
24
24
  }, Rice::Return().takeOwnership())
25
25
  .define_method(
26
26
  "_add_doc",
data/ext/tomoto/mglda.cpp CHANGED
@@ -23,7 +23,7 @@ void init_mglda(Rice::Module& m) {
23
23
  args.alphaML = alpha_ml;
24
24
  args.eta = eta_g;
25
25
  // TODO more args
26
- return tomoto::IMGLDAModel::create((tomoto::TermWeight)tw, args);
26
+ return tomoto::IMGLDAModel::create((tomoto::TermWeight)tw, args).release();
27
27
  }, Rice::Return().takeOwnership())
28
28
  .define_method(
29
29
  "_add_doc",
data/ext/tomoto/pa.cpp CHANGED
@@ -17,7 +17,7 @@ void init_pa(Rice::Module& m) {
17
17
  if (seed >= 0) {
18
18
  args.seed = seed;
19
19
  }
20
- return tomoto::IPAModel::create((tomoto::TermWeight)tw, args);
20
+ return tomoto::IPAModel::create((tomoto::TermWeight)tw, args).release();
21
21
  }, Rice::Return().takeOwnership())
22
22
  .define_method(
23
23
  "k1",
data/ext/tomoto/plda.cpp CHANGED
@@ -20,7 +20,7 @@ void init_plda(Rice::Module& m) {
20
20
  if (seed >= 0) {
21
21
  args.seed = seed;
22
22
  }
23
- return tomoto::IPLDAModel::create((tomoto::TermWeight)tw, args);
23
+ return tomoto::IPLDAModel::create((tomoto::TermWeight)tw, args).release();
24
24
  }, Rice::Return().takeOwnership())
25
25
  .define_method(
26
26
  "_add_doc",
data/ext/tomoto/slda.cpp CHANGED
@@ -29,7 +29,7 @@ void init_slda(Rice::Module& m) {
29
29
  if (seed >= 0) {
30
30
  args.seed = seed;
31
31
  }
32
- return tomoto::ISLDAModel::create((tomoto::TermWeight)tw, args);
32
+ return tomoto::ISLDAModel::create((tomoto::TermWeight)tw, args).release();
33
33
  }, Rice::Return().takeOwnership())
34
34
  .define_method(
35
35
  "_add_doc",
Binary file
Binary file
Binary file
Binary file
data/lib/tomoto/lda.rb CHANGED
@@ -11,6 +11,7 @@ module Tomoto
11
11
  def self.load(filename)
12
12
  model = new
13
13
  model._load(filename)
14
+ model.instance_variable_set(:@prepared, true)
14
15
  model
15
16
  end
16
17
 
@@ -1,3 +1,3 @@
1
1
  module Tomoto
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
@@ -2,10 +2,10 @@
2
2
  * @file EigenRand
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.4.1
6
- * @date 2022-08-13
7
- *
8
- * @copyright Copyright (c) 2020-2021
5
+ * @version 0.5.1
6
+ * @date 2024-09-08
7
+ *
8
+ * @copyright Copyright (c) 2020-2024
9
9
  *
10
10
  */
11
11