Class: Phronomy::Agent::Context::Knowledge::Loader::PlainTextLoader
- Defined in:
- lib/phronomy/agent/context/knowledge/loader/plain_text_loader.rb
Overview
Loads a plain-text file as a single document.
Instance Method Summary collapse
-
#load(source) ⇒ Array<Hash>
Single-element array with the file contents.
Instance Method Details
#load(source) ⇒ Array<Hash>
Returns single-element array with the file contents.
19 20 21 22 |
# File 'lib/phronomy/agent/context/knowledge/loader/plain_text_loader.rb', line 19 def load(source) text = File.read(source, encoding: "UTF-8") [{text: text, metadata: {source: source}}] end |