chunkipy.text_chunker.data_models
Classes
|
Represents a single chunk of text, which consists of multiple text parts. |
|
A list-like collection of chunks with utility methods for aggregation. |
A deque-like collection of TextParts with utility methods for aggregation. |
|
|
Represents a fragment or segment of a complete text, along with its character size. |
|
A list-like collection of TextParts. |
A base class with utilities for handling collections of TextPart. |
- class chunkipy.text_chunker.data_models.Chunk(overlap=<factory>, content=<factory>)[source]
Bases:
objectRepresents a single chunk of text, which consists of multiple text parts.
Computed Properties: :param text: Represents the full text of the chunk by joining all ‘text’ values from its ‘text parts. :type overlap:
Overlap:param overlap: A list of TextPart objects that make up the chunk. :type content:TextParts:param content: A list of TextPart objects that make up the chunk.- 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]
-
A list-like collection of chunks with utility methods for aggregation.
Inherits from ‘list’ to act as a standard list, while providing additional methods for aggregated operations.
- class chunkipy.text_chunker.data_models.Overlap[source]
-
A deque-like collection of TextParts with utility methods for aggregation. Inherits from deque to act as a standard deque, while providing additional methods for aggregated operations (e.g. size).
- 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]A list-like collection of TextParts. Inherits from list to act as a standard list, and from TextPartsMixin to provide additional methods for aggregated operations (e.g. size, text).