Class: DTW::Alignment
- Inherits:
-
Data
- Object
- Data
- DTW::Alignment
- Defined in:
- lib/dtwrb/alignment.rb,
sig/dtwrb.rbs
Constant Summary collapse
- UNDEFINED =
Alignment.new(path: [].freeze, cost: Float::INFINITY)
Instance Attribute Summary collapse
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #distance ⇒ ::Float
- #steps ⇒ ::Integer
- #to_a ⇒ ::Array[cell]
- #to_h ⇒ ::Hash[::Symbol, untyped]
- #undefined? ⇒ Boolean
- #with ⇒ Alignment
Instance Attribute Details
#cost ⇒ Object (readonly)
Returns the value of attribute cost
4 5 6 |
# File 'lib/dtwrb/alignment.rb', line 4 def cost @cost end |
#path ⇒ Object (readonly)
Returns the value of attribute path
4 5 6 |
# File 'lib/dtwrb/alignment.rb', line 4 def path @path end |
Class Method Details
.new ⇒ Alignment
134 |
# File 'sig/dtwrb.rbs', line 134
def self.new: (path: ::Array[cell], cost: ::Float) -> Alignment
|
Instance Method Details
#distance ⇒ ::Float
7 |
# File 'lib/dtwrb/alignment.rb', line 7 def distance = steps.zero? ? cost : cost / steps |
#steps ⇒ ::Integer
5 |
# File 'lib/dtwrb/alignment.rb', line 5 def steps = path.length |
#to_a ⇒ ::Array[cell]
11 |
# File 'lib/dtwrb/alignment.rb', line 11 def to_a = path |
#to_h ⇒ ::Hash[::Symbol, untyped]
140 |
# File 'sig/dtwrb.rbs', line 140
def to_h: () -> ::Hash[::Symbol, untyped]
|
#undefined? ⇒ Boolean
9 |
# File 'lib/dtwrb/alignment.rb', line 9 def undefined? = path.empty? |