diarize-ruby 0.3.1 → 0.3.2

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: fea2a948f5ae15b922bf1911df35c3bdfb24b5f3
4
- data.tar.gz: ff9da8967f4f5b9692669c677833fe449154fa18
3
+ metadata.gz: b91ae2c0c7d4a0d7bafc5babcf5c75c51c58c937
4
+ data.tar.gz: 15b61a7d0d474db5da179722033ac66fc9cbe395
5
5
  SHA512:
6
- metadata.gz: 42de27a42610a7c04409f04d56d2b124eed8fa0418843516701c1cb18092ed4fe05aa1fee015d2019438443fa7c016b10fc51391bcfb7d99c1bdab28f8cb514d
7
- data.tar.gz: cdf8c7a4e935db59c4b3a678c56e0b18e9be41f906583d939e86feb596f62847905b5c6a766575108bf7be973661e1a3b6e56b16ee754a37e69d9073f36d4c83
6
+ metadata.gz: 9a1c9a8ed7f37c46fa3dcdd2e541d7021c8ab9abfe7e544c1a67f11e1b260fadbc064ab0f17d0b73a7b636c1e0b5a9cf511696544f27bbaf5359a6b235361509
7
+ data.tar.gz: 3148f413da7b30e3fb1d412cac6d686600c516ee97f562c4364f9a0da297ff469a4bcd59516597514536f679c3bf64f3ad42f54a2231a1a13fc704662c55979b
@@ -1,3 +1,7 @@
1
+ ## [v0.3.2] - 2016-11-14
2
+
3
+ - Remove audio player and playback option
4
+
1
5
  ## [v0.3.1] - 2016-11-08
2
6
 
3
7
  - Fixed README and examples
data/README.md CHANGED
@@ -41,11 +41,6 @@ identification.
41
41
 
42
42
  $ bundle install
43
43
 
44
- Note: To make audio playback work with [Audio Playback](https://github.com/arirusso/audio-playback), you should install the following native libraries (homebrew):
45
-
46
- brew install libffi
47
- brew install portaudio
48
-
49
44
  If you are using a different version of LIUM than what is bundled in the `bin` folder, you can do so by setting an environment variable.
50
45
 
51
46
  $ export DIARIZE_RUBY_RJB_LOAD_PATH=<path-to-LIUM-jar-file>
@@ -63,8 +58,6 @@ If you are using a different version of LIUM than what is bundled in the `bin` f
63
58
  > speakers.first.gender
64
59
  > speakers.first.model.mean_log_likelihood
65
60
  > speakers.first.model.components.size
66
- > audio.segments_by_speaker(speakers.first)[0].play
67
- > audio.segments_by_speaker(speakers.first)[1].play
68
61
  > ...
69
62
  > speakers ||= other_speakers
70
63
  > Diarize::Speaker.match(speakers)
@@ -29,5 +29,4 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "rjb", "~> 1.5"
30
30
  spec.add_dependency "to-rdf", "~> 0"
31
31
  spec.add_dependency "jblas-ruby", "~> 1.1"
32
- spec.add_dependency "audio-playback"
33
32
  end
@@ -12,7 +12,6 @@ require "diarize/lium"
12
12
  require "diarize/audio"
13
13
  require "diarize/segment"
14
14
  require "diarize/segmentation"
15
- require "diarize/audio_player"
16
15
  require "diarize/super_vector"
17
16
 
18
17
  # Extenions to the {Ruby-Java Bridge}[http://rjb.rubyforge.org/] module that
@@ -182,9 +182,9 @@ module Diarize
182
182
  clustersSplitClust = diarization.speech("10,10,50", clusterSet, clustersSegInit, clustersDClust, featureSet, parameter)
183
183
  clusters = diarization.gender(clusterSet, clustersSplitClust, featureSet, parameter)
184
184
  if parameter.parameterDiarization.isCEClustering
185
- # If true, the program computes the NCLR/CE clustering at the end.
186
- # The diarization error rate is minimized.
187
- # If this option is not set, the program stops right after the detection of the gender
185
+ # If true, the program computes the NCLR/CE clustering at the end.
186
+ # The diarization error rate is minimized.
187
+ # If this option is not set, the program stops right after the detection of the gender
188
188
  # and the resulting segmentation is sufficient for a transcription system.
189
189
  clusters = diarization.speakerClustering(parameterDiarization.getThreshold("c"), "ce", clusterSet, clusters, featureSet, parameter)
190
190
  end
@@ -1,12 +1,10 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), 'audio_player')
2
-
3
1
  require 'rubygems'
4
2
  require 'to_rdf'
5
3
  require 'uri'
6
4
 
7
5
  module Diarize
8
-
9
6
  class Segment
7
+ include ToRdf
10
8
 
11
9
  attr_reader :start, :duration, :gender, :bandwidth
12
10
 
@@ -23,20 +21,13 @@ module Diarize
23
21
  Speaker.find_or_create(URI("#{@audio.base_uri}##{@speaker_id}"), @speaker_gender)
24
22
  end
25
23
 
26
- def play(options = {})
27
- player = AudioPlayer.new
28
- player.play(@audio.file, options.merge({:start => start, :duration => duration}))
29
- end
30
-
31
- include ToRdf
32
-
33
24
  def namespaces
34
25
  super.merge 'ws' => 'http://wsarchive.prototype0.net/ontology/'
35
26
  end
36
27
 
37
28
  def uri
38
29
  # http://www.w3.org/TR/media-frags/
39
- URI("#{@audio.base_uri}#t=#{start},#{start+duration}")
30
+ URI("#{@audio.base_uri}#t=#{start},#{start + duration}")
40
31
  end
41
32
 
42
33
  def type_uri
@@ -52,7 +43,5 @@ module Diarize
52
43
  'ws:speaker' => speaker,
53
44
  }
54
45
  end
55
-
56
46
  end
57
-
58
47
  end
@@ -1,16 +1,15 @@
1
1
  module Diarize
2
-
3
2
  class Segmentation
4
3
 
5
4
  def self.from_seg_file(audio, seg_file)
6
5
  segmentation = []
7
6
  File.open(seg_file).each_line do |line|
8
7
  next if line.start_with? ';;'
9
- parts = line.split(' ')
10
- start = parts[2].to_i / 100.0
11
- duration = parts[3].to_i / 100.0
12
- gender = parts[4]
13
- bandwidth = parts[6]
8
+ parts = line.split(' ')
9
+ start = parts[2].to_i / 100.0
10
+ duration = parts[3].to_i / 100.0
11
+ gender = parts[4]
12
+ bandwidth = parts[6]
14
13
  speaker_id = parts[7]
15
14
  segmentation << Segment.new(audio, start, duration, gender, bandwidth, speaker_id)
16
15
  end
@@ -33,5 +32,4 @@ module Diarize
33
32
  end
34
33
 
35
34
  end
36
-
37
35
  end
@@ -103,7 +103,7 @@ module Diarize
103
103
  gaussian = model.components.get(k)
104
104
  gaussian.dim.times do |i|
105
105
  normalized_mean = (1.0 / distance_to_ubm) * gaussian.mean(i) + (1.0 - 1.0 / distance_to_ubm) * speaker_ubm.model.components.get(k).mean(i)
106
- gaussian.set_mean(i, normalized_mean)
106
+ gaussian.set_mean(i, normalized_mean)
107
107
  end
108
108
  end
109
109
  @normalized = true
@@ -1,3 +1,3 @@
1
1
  module Diarize
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  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.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yves Raimond
@@ -109,20 +109,6 @@ dependencies:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: '1.1'
112
- - !ruby/object:Gem::Dependency
113
- name: audio-playback
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :runtime
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
112
  description: A library for Ruby wrapping the LIUM Speaker Diarization and including
127
113
  a few extra tools
128
114
  email:
@@ -144,7 +130,6 @@ files:
144
130
  - diarize-ruby.gemspec
145
131
  - lib/diarize.rb
146
132
  - lib/diarize/audio.rb
147
- - lib/diarize/audio_player.rb
148
133
  - lib/diarize/lium.rb
149
134
  - lib/diarize/segment.rb
150
135
  - lib/diarize/segmentation.rb
@@ -1,22 +0,0 @@
1
- module Diarize
2
-
3
- class AudioPlayer
4
-
5
- def play(file, options = {})
6
- output = AudioPlayback::Device::Output.by_id(1) rescue nil
7
- defaults = {
8
- :channels => [0, 1],
9
- :latency => 1,
10
- :output_device => output,
11
- :buffer_size => 4048
12
- }
13
- options, stream = defaults.merge(options), nil
14
- playback = AudioPlayback.play(file.path, options)
15
- stream ||= playback.stream
16
- stream.start
17
- stream.block
18
- end
19
-
20
- end
21
-
22
- end