Skip to content

base

Class info

Classes

Name Children Inherits
Annotator
docler.annotators.base
Base class for chunk annotation processors.

🛈 DocStrings

Base classes for text chunking implementations.

Annotator

Bases: ABC, BaseProvider[TConfig]

Base class for chunk annotation processors.

Source code in src/docler/annotators/base.py
class Annotator[TConfig: BaseModel](ABC, BaseProvider[TConfig]):
    """Base class for chunk annotation processors."""

    Config: ClassVar[type[BaseAnnotatorConfig]]

    @abstractmethod
    async def annotate(
        self,
        document: ChunkedDocument,
    ) -> ChunkedDocument:
        """Annotate a chunked document with additional metadata.

        Args:
            document: Chunked document containing the original content and chunks

        Returns:
            Chunked document with annotated chunks
        """
        raise NotImplementedError

annotate abstractmethod async

annotate(document: ChunkedDocument) -> ChunkedDocument

Annotate a chunked document with additional metadata.

Parameters:

Name Type Description Default
document ChunkedDocument

Chunked document containing the original content and chunks

required

Returns:

Type Description
ChunkedDocument

Chunked document with annotated chunks

Source code in src/docler/annotators/base.py
@abstractmethod
async def annotate(
    self,
    document: ChunkedDocument,
) -> ChunkedDocument:
    """Annotate a chunked document with additional metadata.

    Args:
        document: Chunked document containing the original content and chunks

    Returns:
        Chunked document with annotated chunks
    """
    raise NotImplementedError