Class: Lernen::System::BlockSUL
- Inherits:
-
MooreLikeSUL
- Object
- SUL
- MooreLikeSUL
- Lernen::System::BlockSUL
- Defined in:
- lib/lernen/system/block_sul.rb
Overview
BlockSUL is a system under learning (SUL) constructed from a block.
A block is expected to behave like a membership query.
Instance Method Summary collapse
-
#initialize(cache: true, &block) ⇒ BlockSUL
constructor
: (?cache: bool) { (Array) -> Out } -> void.
- #query_empty ⇒ Object
- #setup ⇒ Object
- #step(input) ⇒ Object
Methods inherited from SUL
#query, #query_last, #shutdown, #stats
Constructor Details
Instance Method Details
#query_empty ⇒ Object
36 37 38 |
# File 'lib/lernen/system/block_sul.rb', line 36 def query_empty @block.call([]) end |
#setup ⇒ Object
25 26 27 |
# File 'lib/lernen/system/block_sul.rb', line 25 def setup @word = [] end |
#step(input) ⇒ Object
30 31 32 33 |
# File 'lib/lernen/system/block_sul.rb', line 30 def step(input) @word << input @block.call(@word) end |