mirror of
https://github.com/DS4SD/docling.git
synced 2025-08-02 23:42:22 +00:00
29 lines
705 B
Python
29 lines
705 B
Python
from abc import ABC, abstractmethod
|
|
from typing import Any, Iterable
|
|
|
|
from docling_core.types.doc import DoclingDocument, NodeItem
|
|
|
|
from docowling.datamodel.base_models import Page
|
|
from docowling.datamodel.document import ConversionResult
|
|
|
|
|
|
class BasePageModel(ABC):
|
|
@abstractmethod
|
|
def __call__(
|
|
self, conv_res: ConversionResult, page_batch: Iterable[Page]
|
|
) -> Iterable[Page]:
|
|
pass
|
|
|
|
|
|
class BaseEnrichmentModel(ABC):
|
|
|
|
@abstractmethod
|
|
def is_processable(self, doc: DoclingDocument, element: NodeItem) -> bool:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def __call__(
|
|
self, doc: DoclingDocument, element_batch: Iterable[NodeItem]
|
|
) -> Iterable[Any]:
|
|
pass
|