diarize-ruby 0.3.11 → 0.3.12

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
  SHA1:
3
- metadata.gz: 862081b1f139a2d177181be622086de18018aabd
4
- data.tar.gz: 9f10cbcc0741b6ad845b2d5df000420e71aa4807
3
+ metadata.gz: cf974c96cf25699a635fe8adceff3839eb519dfd
4
+ data.tar.gz: dd4b2a3ee90d2893640110dc7b46a86086f9da56
5
5
  SHA512:
6
- metadata.gz: 6543825ebf8a9909e3d49bfa81afd8f7146b426fd5bbf54fa1c3bc5561433625f384678c077bd63ecaa90baedd783aec2c2e3a1a09c372ee6d92827f36f7b6bc
7
- data.tar.gz: 52f7db8c0bb30e16a13f61de11bc55ad43c26f7e3d2670a68889cd798c149d621dfa5e2e0260dacb89fe96a6e100e983b3e7a4893bcc84579fa3cd6f1a7bb643
6
+ metadata.gz: 9c12516dc25bd04468c4d771b29c848305807bf8a4fe3e7de2a6a64c3c45ca73aaf98cc067e2bf92890682eb5b353698c6fb1a9c1b46c677da7d83be4b119cbd
7
+ data.tar.gz: 06e93c8f82a8b3ffeb9f9fc3a7b01ee06368ef91edf55747f349af80cad91839cc5385760c8024e66ea47d447956d20b4abb072f898d4e0ab9e0979ba92b9a09
@@ -51,9 +51,11 @@ module Diarize
51
51
  s['speaker'] = speaker.as_json if speaker
52
52
  }
53
53
  end
54
+ alias_method :_as_json, :as_json
54
55
 
55
56
  def to_json
56
57
  as_json.to_json
57
58
  end
59
+ alias_method :_to_json, :to_json
58
60
  end
59
61
  end
@@ -171,10 +171,12 @@ module Diarize
171
171
  'supervector_hash' => supervector.hash.to_s
172
172
  }
173
173
  end
174
+ alias_method :_as_json, :as_json
174
175
 
175
176
  def to_json
176
177
  as_json.to_json
177
178
  end
179
+ alias_method :_to_json, :to_json
178
180
 
179
181
  protected
180
182
 
@@ -1,3 +1,3 @@
1
1
  module Diarize
2
- VERSION = "0.3.11"
2
+ VERSION = "0.3.12"
3
3
  end
@@ -35,13 +35,17 @@ class SegmentTest < Test::Unit::TestCase
35
35
  assert_equal segment.uri, URI('http://example.com#t=2,7')
36
36
  end
37
37
 
38
- def test_as_json
38
+ def test_as_json_and_to_json
39
39
  segment = Diarize::Segment.new(OpenStruct.new({:base_uri => 'http://example.com'}), 2, 5, 'm', nil, 's1')
40
40
  model_file = File.join(File.dirname(__FILE__), 'data', 'speaker1.gmm')
41
41
  speaker = Diarize::Speaker.new(URI.parse(""), "F", model_file)
42
42
  speaker.mean_log_likelihood = 0.9
43
- segment.expects(:speaker).returns(speaker).twice
43
+ segment.expects(:speaker).returns(speaker).at_least(3)
44
44
  as_json = segment.as_json
45
+ assert_equal as_json, segment._as_json
46
+ assert_equal as_json, JSON.parse(segment.to_json)
47
+ assert_equal as_json, JSON.parse(segment._to_json)
48
+
45
49
  assert_equal true, as_json.has_key?('start')
46
50
  assert_equal true, as_json.has_key?('duration')
47
51
  assert_equal true, as_json.has_key?('gender')
@@ -139,21 +139,14 @@ class SpeakerTest < Test::Unit::TestCase
139
139
  assert_equal true, to_rdf.include?("https://www.example.com/model/1")
140
140
  end
141
141
 
142
- def test_as_json
142
+ def test_as_json_and_to_json
143
143
  speaker = Diarize::Speaker.new(URI.parse(""), "F", @model_file)
144
144
  speaker.mean_log_likelihood = 0.9
145
145
  as_json = speaker.as_json
146
- assert_equal true, as_json.has_key?('gender')
147
- assert_equal true, as_json.has_key?('model')
148
- assert_equal true, as_json.has_key?('mean_log_likelihood')
149
- assert_equal true, as_json.has_key?('supervector_hash')
150
- end
146
+ assert_equal as_json, speaker._as_json
147
+ assert_equal as_json, JSON.parse(speaker.to_json)
148
+ assert_equal as_json, JSON.parse(speaker._to_json)
151
149
 
152
- def test_to_json
153
- speaker = Diarize::Speaker.new(URI.parse(""), "F", @model_file)
154
- speaker.mean_log_likelihood = 0.9
155
- to_json = speaker.to_json
156
- as_json = JSON.parse(to_json)
157
150
  assert_equal true, as_json.has_key?('gender')
158
151
  assert_equal true, as_json.has_key?('model')
159
152
  assert_equal true, as_json.has_key?('mean_log_likelihood')
@@ -3,7 +3,7 @@ require 'test_helper'
3
3
  class VersionTest < Test::Unit::TestCase
4
4
 
5
5
  def test_current_version
6
- assert_equal "0.3.11", Diarize::VERSION
6
+ assert_equal "0.3.12", Diarize::VERSION
7
7
  end
8
8
 
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diarize-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yves Raimond