Class: VoiceBase::JSON::Word
- Inherits:
-
Object
- Object
- VoiceBase::JSON::Word
- Defined in:
- lib/voicebase/json/word.rb
Instance Attribute Summary collapse
-
#confidence ⇒ Object
(also: #c)
Returns the value of attribute confidence.
-
#end_time ⇒ Object
(also: #e)
Returns the value of attribute end_time.
-
#error ⇒ Object
Returns the value of attribute error.
-
#metadata ⇒ Object
(also: #m)
Returns the value of attribute metadata.
-
#sequence ⇒ Object
(also: #p)
Returns the value of attribute sequence.
-
#start_time ⇒ Object
(also: #s)
Returns the value of attribute start_time.
-
#word ⇒ Object
(also: #w)
Returns the value of attribute word.
Instance Method Summary collapse
- #==(word) ⇒ Object
- #clone ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(options = {}) ⇒ Word
constructor
A new instance of Word.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Word
Returns a new instance of Word.
24 25 26 27 28 |
# File 'lib/voicebase/json/word.rb', line 24 def initialize(={}) .each do |k,v| self.send("#{k}=",v) end end |
Instance Attribute Details
#confidence ⇒ Object Also known as: c
Returns the value of attribute confidence.
6 7 8 |
# File 'lib/voicebase/json/word.rb', line 6 def confidence @confidence end |
#end_time ⇒ Object Also known as: e
Returns the value of attribute end_time.
5 6 7 |
# File 'lib/voicebase/json/word.rb', line 5 def end_time @end_time end |
#error ⇒ Object
Returns the value of attribute error.
8 9 10 |
# File 'lib/voicebase/json/word.rb', line 8 def error @error end |
#metadata ⇒ Object Also known as: m
Returns the value of attribute metadata.
9 10 11 |
# File 'lib/voicebase/json/word.rb', line 9 def @metadata end |
#sequence ⇒ Object Also known as: p
Returns the value of attribute sequence.
3 4 5 |
# File 'lib/voicebase/json/word.rb', line 3 def sequence @sequence end |
#start_time ⇒ Object Also known as: s
Returns the value of attribute start_time.
4 5 6 |
# File 'lib/voicebase/json/word.rb', line 4 def start_time @start_time end |
#word ⇒ Object Also known as: w
Returns the value of attribute word.
7 8 9 |
# File 'lib/voicebase/json/word.rb', line 7 def word @word end |
Instance Method Details
#==(word) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/voicebase/json/word.rb', line 42 def ==(word) self.sequence == word.sequence && self.start_time == word.start_time && self.end_time == word.end_time && self.confidence == word.confidence && self.word == word.word && self. == word. end |
#clone ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/voicebase/json/word.rb', line 30 def clone clone = VoiceBase::JSON::Word.new clone.sequence = sequence clone.start_time = start_time clone.end_time = end_time clone.confidence = confidence clone.error = error clone.word = word clone. = clone end |
#empty? ⇒ Boolean
51 52 53 |
# File 'lib/voicebase/json/word.rb', line 51 def empty? sequence.nil? && start_time.nil? && end_time.nil? && (word.nil? || word.empty?) end |
#to_hash ⇒ Object
55 56 57 |
# File 'lib/voicebase/json/word.rb', line 55 def to_hash { "p" => sequence, "c" => confidence, "s" => start_time, "e" => end_time, "w" => word } end |
#to_json ⇒ Object
59 60 61 |
# File 'lib/voicebase/json/word.rb', line 59 def to_json { "p" => sequence, "c" => confidence, "s" => start_time, "e" => end_time, "w" => word }.to_json end |