Class: Langchain::Chunker::Sentence
- Defined in:
- lib/langchain/chunker/sentence.rb
Overview
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
Constructor Details
#initialize(text) ⇒ Langchain::Chunker::Sentence
16 17 18 |
# File 'lib/langchain/chunker/sentence.rb', line 16 def initialize(text) @text = text end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
12 13 14 |
# File 'lib/langchain/chunker/sentence.rb', line 12 def text @text end |
Instance Method Details
#chunks ⇒ Array<Langchain::Chunk>
21 22 23 24 25 26 |
# File 'lib/langchain/chunker/sentence.rb', line 21 def chunks ps = PragmaticSegmenter::Segmenter.new(text: text) ps.segment.map do |chunk| Langchain::Chunk.new(text: chunk) end end |