Class MaxLengthBasedTextSplitter

java.lang.Object
com.github.hakenadu.javalangchains.chains.qa.split.MaxLengthBasedTextSplitter
All Implemented Interfaces:
TextSplitter
Direct Known Subclasses:
TiktokenTextSplitter

public abstract class MaxLengthBasedTextSplitter
extends Object
implements TextSplitter
abstract base class for TextSplitter implementations that use a max length for deciding when to split
  • Constructor Details

  • Method Details

    • getLength

      protected abstract int getLength​(String textPart)
      provide the length value for a text part
      Parameters:
      textPart - the text part which needs to be measured
      Returns:
      the length for the passed textPart
    • split

      public final List<String> split​(String text)
      Description copied from interface: TextSplitter
      Splits a text into one or more subtexts
      Specified by:
      split in interface TextSplitter
      Parameters:
      text - text to split
      Returns:
      List with text partitions