Class: ViterbiSemiring

Inherits:
Semiring show all
Defined in:
lib/zipf/semirings.rb

Instance Attribute Summary

Attributes inherited from Semiring

#add, #convert, #multiply, #null, #one

Instance Method Summary collapse

Constructor Details

#initializeViterbiSemiring

Returns a new instance of ViterbiSemiring.



22
23
24
25
26
27
28
# File 'lib/zipf/semirings.rb', line 22

def initialize
  @add = Proc.new { |a,b| [a,b].max }
  @multiply =  Proc.new { |a,b| a*b }
  @one = 1.0
  @null = 0.0
  @convert = Proc.new { |v| v }
end