Module: Gemmy::Patches::ArrayPatch::InstanceMethods::RunCommands
- Defined in:
- lib/gemmy/patches/array_patch.rb
Instance Method Summary collapse
-
#run_commands ⇒ Object
Part of the Nlp API Example: include Gemmy::Components::Nlp parse_sentence(“A sentence”).run_commands.
Instance Method Details
#run_commands ⇒ Object
Part of the Nlp API Example:
include Gemmy::Components::Nlp
parse_sentence("A sentence").run_commands
Under the hood, parse_sentence is creating procs in the db These are evaluated here
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/gemmy/patches/array_patch.rb', line 54 def run_commands _eval_noun = Gemmy.patch("string/i/eval_noun") .method(:_eval_noun) return self.flat_map do |cmds| cmds&.map do |cmd| eval(VerbLexicon.get cmd[:verb].to_sym).call(*( cmd[:nouns]&.map do |noun| _eval_noun.call(noun, self) end ).to_a.compact) end end.compact end |