Class TextSplitter

java.lang.Object
com.hw.langchain.text.splitter.TextSplitter
All Implemented Interfaces:
BaseDocumentTransformer
Direct Known Subclasses:
CharacterTextSplitter, RecursiveCharacterTextSplitter

public abstract class TextSplitter extends Object implements BaseDocumentTransformer
Interface for splitting text into chunks.
Author:
HamaWhite
  • Field Details

    • chunkSize

      protected int chunkSize
      Maximum size of chunks to return.
    • chunkOverlap

      protected int chunkOverlap
      Overlap in characters between chunks.
    • lengthFunction

      protected Function<String,Integer> lengthFunction
      Function that measures the length of given chunks.
    • keepSeparator

      protected boolean keepSeparator
      Whether or not to keep the separator in the chunks.
    • addStartIndex

      protected boolean addStartIndex
      If `true`, includes chunk's start index in metadata
  • Constructor Details

    • TextSplitter

      public TextSplitter()
  • Method Details