chunkipy.text_chunker.data_models
Classes
|
Single chunk returned by a text chunker. |
|
List-like collection of |
Deque-like collection used to carry overlap between consecutive chunks. |
|
|
Represents a fragment or segment of a complete text, along with its character size. |
|
List-like collection of |
A base class with utilities for handling collections of TextPart. |
- class chunkipy.text_chunker.data_models.Chunk(overlap=<factory>, content=<factory>)[source]
Bases:
objectSingle chunk returned by a text chunker.
A chunk is composed of two ordered collections:
overlap: text parts repeated from the previous chunk to preserve contextcontent: text parts that are unique to the current chunk
The
textandsizeproperties are computed over the combinedtext_partsview.- property size: int
Calculates and returns the total size of all TextPart objects within text_parts.
- Returns:
The total size of all TextPart objects.
- Return type:
- class chunkipy.text_chunker.data_models.Chunks(iterable=(), /)[source]
-
List-like collection of
Chunkobjects returned by chunkers.
- class chunkipy.text_chunker.data_models.Overlap[source]
Bases:
TextPartsMixin,deque[TextPart]Deque-like collection used to carry overlap between consecutive chunks.
- class chunkipy.text_chunker.data_models.TextPart(size, text)[source]
Bases:
objectRepresents a fragment or segment of a complete text, along with its character size.
- Parameters:
- class chunkipy.text_chunker.data_models.TextParts(iterable=(), /)[source]
Bases:
TextPartsMixin,list[TextPart]List-like collection of
TextPartvalues.This container preserves the normal
listAPI while exposing aggregatedsizeandtextproperties viaTextPartsMixin.