Class: BooleanSemiring

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

#initializeBooleanSemiring

Returns a new instance of BooleanSemiring.



12
13
14
15
16
17
18
# File 'lib/zipf/semirings.rb', line 12

def initialize
  @add = Proc.new { |a,b| a||b }
  @multiply =  Proc.new { |a,b| a&&b }
  @one = true
  @null = false
  @convert = Proc.new { |v| true && v!=0 }
end