Skip to content

Base

BaseChunker

Bases: ABC

Base class for all Chunker implementations.

Source code in supermat/core/chunking/base.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class BaseChunker(ABC):
    """
    Base class for all Chunker implementations.
    """

    @abstractmethod
    def create_chunks(self, processed_document: ParsedDocumentType) -> DocumentChunksType:  # noqa: U100
        """Build chunks from the given ParsedDocument into list of ChunkDocuments.
        This is the public class that is called for any chunking strategy.

        Args:
            processed_document (ParsedDocumentType): The processed document that needs to split into chunks.

        Returns:
            DocumentChunksType: The chunks built by the given strategy.
        """

create_chunks(processed_document) abstractmethod

Build chunks from the given ParsedDocument into list of ChunkDocuments. This is the public class that is called for any chunking strategy.

Parameters:

Name Type Description Default
processed_document ParsedDocumentType

The processed document that needs to split into chunks.

required

Returns:

Name Type Description
DocumentChunksType DocumentChunksType

The chunks built by the given strategy.

Source code in supermat/core/chunking/base.py
16
17
18
19
20
21
22
23
24
25
26
@abstractmethod
def create_chunks(self, processed_document: ParsedDocumentType) -> DocumentChunksType:  # noqa: U100
    """Build chunks from the given ParsedDocument into list of ChunkDocuments.
    This is the public class that is called for any chunking strategy.

    Args:
        processed_document (ParsedDocumentType): The processed document that needs to split into chunks.

    Returns:
        DocumentChunksType: The chunks built by the given strategy.
    """