Class: CountingSemiring
Instance Attribute Summary
Attributes inherited from Semiring
#add, #convert, #multiply, #null, #one
Instance Method Summary collapse
-
#initialize ⇒ CountingSemiring
constructor
A new instance of CountingSemiring.
Constructor Details
#initialize ⇒ CountingSemiring
Returns a new instance of CountingSemiring.
73 74 75 76 77 78 79 |
# File 'lib/zipf/semirings.rb', line 73 def initialize @add = Proc.new { |a,b| a+b } @multiply = Proc.new { |a,b| a*b } @one = 1.0 @null = 0.0 @convert = Proc.new { |v| if v!=0 then 1 else 0 end } end |