Class TextChunkSplitterConfig
java.lang.Object
com.norconex.importer.handler.BaseLabelableConfig
com.norconex.importer.handler.BaseDocHandlerConfig
com.norconex.importer.handler.splitter.BaseDocumentSplitterConfig
com.norconex.importer.handler.splitter.impl.TextChunkSplitterConfig
- All Implemented Interfaces:
Labelable
Splits a document's text into chunks sized for embedding models, breaking at the cleanest boundary available (paragraph, then sentence, then word) rather than cutting mid-word at a fixed offset.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanintThe number of characters from the end of a chunk to repeat at the start of the next one, so a passage spanning a chunk boundary is not lost from either side's context.intThe maximum number of characters a chunk should have.String to append to the parent document reference to form each chunk's reference, followed by the chunk number (1-based).inthashCode()setChunkOverlap(int chunkOverlap) The number of characters from the end of a chunk to repeat at the start of the next one, so a passage spanning a chunk boundary is not lost from either side's context.setMaxChunkSize(int maxChunkSize) The maximum number of characters a chunk should have.setReferenceChunkPrefix(String referenceChunkPrefix) String to append to the parent document reference to form each chunk's reference, followed by the chunk number (1-based).toString()Methods inherited from class com.norconex.importer.handler.splitter.BaseDocumentSplitterConfig
isDiscardOriginal, setDiscardOriginalMethods inherited from class com.norconex.importer.handler.BaseLabelableConfig
getLabel, setLabel
-
Field Details
-
DEFAULT_MAX_CHUNK_SIZE
public static final int DEFAULT_MAX_CHUNK_SIZE- See Also:
-
DEFAULT_CHUNK_OVERLAP
public static final int DEFAULT_CHUNK_OVERLAP- See Also:
-
DEFAULT_REFERENCE_CHUNK_PREFIX
- See Also:
-
-
Constructor Details
-
TextChunkSplitterConfig
public TextChunkSplitterConfig()
-
-
Method Details
-
getMaxChunkSize
public int getMaxChunkSize()The maximum number of characters a chunk should have. A chunk may be shorter when a clean break (paragraph, sentence, or word) is found before this limit. Must be at least 1. Default is 1000. -
getChunkOverlap
public int getChunkOverlap()The number of characters from the end of a chunk to repeat at the start of the next one, so a passage spanning a chunk boundary is not lost from either side's context. Default is 100. Set to 0 to disable. -
getReferenceChunkPrefix
String to append to the parent document reference to form each chunk's reference, followed by the chunk number (1-based). Blank means the default, "#chunk". -
setMaxChunkSize
The maximum number of characters a chunk should have. A chunk may be shorter when a clean break (paragraph, sentence, or word) is found before this limit. Must be at least 1. Default is 1000.- Returns:
this.
-
setChunkOverlap
The number of characters from the end of a chunk to repeat at the start of the next one, so a passage spanning a chunk boundary is not lost from either side's context. Default is 100. Set to 0 to disable.- Returns:
this.
-
setReferenceChunkPrefix
String to append to the parent document reference to form each chunk's reference, followed by the chunk number (1-based). Blank means the default, "#chunk".- Returns:
this.
-
equals
- Overrides:
equalsin classBaseDocumentSplitterConfig
-
canEqual
- Overrides:
canEqualin classBaseDocumentSplitterConfig
-
hashCode
public int hashCode()- Overrides:
hashCodein classBaseDocumentSplitterConfig
-
toString
- Overrides:
toStringin classBaseDocumentSplitterConfig
-