Class: Lernen::Algorithm::Procedural::ProceduralSUL

Inherits:
System::MooreLikeSUL show all
Defined in:
lib/lernen/algorithm/procedural/procedural_sul.rb

Overview

ProceduralSUL is a wrapper of SUL for procedural learning.

Instance Method Summary collapse

Methods inherited from System::SUL

#query_last, #setup, #shutdown, #stats

Constructor Details

#initialize(proc, sul, manager) ⇒ ProceduralSUL

: (

  Call proc,
  System::SUL[In | Call | Return, bool] sul,
  ATRManager[In, Call, Return] manager
) -> void


22
23
24
25
26
27
28
# File 'lib/lernen/algorithm/procedural/procedural_sul.rb', line 22

def initialize(proc, sul, manager)
  super(cache: false)

  @proc = proc
  @sul = sul
  @manager = manager
end

Instance Method Details

#query(word) ⇒ Object



36
37
38
# File 'lib/lernen/algorithm/procedural/procedural_sul.rb', line 36

def query(word)
  @sul.query(@manager.embed(@proc, word))
end

#query_emptyObject



31
32
33
# File 'lib/lernen/algorithm/procedural/procedural_sul.rb', line 31

def query_empty
  @sul.query_last(@manager.embed(@proc, []))
end

#step(_input) ⇒ Object

Raises:

  • (TypeError)


41
42
43
# File 'lib/lernen/algorithm/procedural/procedural_sul.rb', line 41

def step(_input)
  raise TypeError, "ProceduralSUL does not support `step`"
end