Class: CFGHelper::CYK
- Inherits:
-
Object
- Object
- CFGHelper::CYK
- Defined in:
- lib/cfg_helper/cyk.rb
Overview
Implemention of cyk algo.
Instance Attribute Summary collapse
-
#is_in_l ⇒ Object
readonly
Returns the value of attribute is_in_l.
-
#matrix ⇒ Object
readonly
Returns the value of attribute matrix.
Instance Method Summary collapse
-
#initialize(word, custom_rule) ⇒ CYK
constructor
A new instance of CYK.
- #run ⇒ Object
Constructor Details
#initialize(word, custom_rule) ⇒ CYK
8 9 10 11 12 |
# File 'lib/cfg_helper/cyk.rb', line 8 def initialize(word, custom_rule) @word = word @rules = custom_rule.select { |_, val| val.is_a?(Array) } @helper_vars = @rules.values.flatten end |
Instance Attribute Details
#is_in_l ⇒ Object (readonly)
Returns the value of attribute is_in_l.
6 7 8 |
# File 'lib/cfg_helper/cyk.rb', line 6 def is_in_l @is_in_l end |
#matrix ⇒ Object (readonly)
Returns the value of attribute matrix.
6 7 8 |
# File 'lib/cfg_helper/cyk.rb', line 6 def matrix @matrix end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 |
# File 'lib/cfg_helper/cyk.rb', line 14 def run _cyk_fill_diagonal _cyk_fill_matrix @is_in_l = _is_in_l? end |