text_splitters

Port of langchain text splitters to Ruby.
So far only the RecursiveCharacterTextSplitter
is implemented. PRs for others are welcome!
Quick start
$ gem install text_splitters
require "text_splitters"
Usage
RecursiveCharacterTextSplitter
Learn more about this splitter.
text = "Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans."
splitter = ::TextSplitters::RecursiveCharacterTextSplitter.new(chunk_size: 100, chunk_overlap: 20)
output = splitter.split(text)
output[0]
output[1]
Support
If you want to report a bug, or have ideas, feedback or questions about the gem, let me know via GitHub issues and I will do my best to provide a helpful answer. Happy hacking!
License
The gem is available as open source under the terms of the MIT License.
Code of conduct
Everyone interacting in this project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Contribution guide
Pull requests are welcome!