Class: Diarize::Segment
- Inherits:
-
Object
- Object
- Diarize::Segment
- Includes:
- ToRdf
- Defined in:
- lib/diarize/segment.rb
Instance Attribute Summary collapse
-
#bandwidth ⇒ Object
readonly
Returns the value of attribute bandwidth.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#speaker_gender ⇒ Object
readonly
Returns the value of attribute speaker_gender.
-
#speaker_id ⇒ Object
readonly
Returns the value of attribute speaker_id.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
-
#initialize(audio, start, duration, speaker_gender, bandwidth, speaker_id) ⇒ Segment
constructor
A new instance of Segment.
- #namespaces ⇒ Object
- #rdf_mapping ⇒ Object
- #speaker ⇒ Object
- #type_uri ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(audio, start, duration, speaker_gender, bandwidth, speaker_id) ⇒ Segment
Returns a new instance of Segment.
7 8 9 10 11 12 13 14 |
# File 'lib/diarize/segment.rb', line 7 def initialize(audio, start, duration, speaker_gender, bandwidth, speaker_id) @audio = audio @start = start @duration = duration @bandwidth = bandwidth @speaker_id = speaker_id @speaker_gender = speaker_gender end |
Instance Attribute Details
#bandwidth ⇒ Object (readonly)
Returns the value of attribute bandwidth.
5 6 7 |
# File 'lib/diarize/segment.rb', line 5 def bandwidth @bandwidth end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
5 6 7 |
# File 'lib/diarize/segment.rb', line 5 def duration @duration end |
#speaker_gender ⇒ Object (readonly)
Returns the value of attribute speaker_gender.
5 6 7 |
# File 'lib/diarize/segment.rb', line 5 def speaker_gender @speaker_gender end |
#speaker_id ⇒ Object (readonly)
Returns the value of attribute speaker_id.
5 6 7 |
# File 'lib/diarize/segment.rb', line 5 def speaker_id @speaker_id end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
5 6 7 |
# File 'lib/diarize/segment.rb', line 5 def start @start end |
Instance Method Details
#namespaces ⇒ Object
20 21 22 |
# File 'lib/diarize/segment.rb', line 20 def namespaces super.merge({'ws' => 'http://wsarchive.prototype0.net/ontology/'}) end |
#rdf_mapping ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/diarize/segment.rb', line 33 def rdf_mapping { 'ws:start' => start, 'ws:duration' => duration, 'ws:gender' => gender, 'ws:bandwidth' => bandwidth, 'ws:speaker' => speaker, } end |
#speaker ⇒ Object
16 17 18 |
# File 'lib/diarize/segment.rb', line 16 def speaker Speaker.find_or_create(URI("#{@audio.base_uri}##{@speaker_id}"), @speaker_gender) end |
#type_uri ⇒ Object
29 30 31 |
# File 'lib/diarize/segment.rb', line 29 def type_uri 'ws:Segment' end |
#uri ⇒ Object
24 25 26 27 |
# File 'lib/diarize/segment.rb', line 24 def uri # http://www.w3.org/TR/media-frags/ URI("#{@audio.base_uri}#t=#{start},#{start + duration}") end |