Initialize parser with configuration. Args: config: Parser configuration containing device, document_dir and other settings
(self, config: ParserConfig)
| 14 | # Abstract base class of parser |
| 15 | class BaseParser(ABC): |
| 16 | def __init__(self, config: ParserConfig) -> None: |
| 17 | """ |
| 18 | Initialize parser with configuration. |
| 19 | |
| 20 | Args: |
| 21 | config: Parser configuration containing device, document_dir and other settings |
| 22 | """ |
| 23 | self.config = config |
| 24 | self.device = config.device |
| 25 | self.document_dir = Path(config.document_dir) if config.document_dir else None |
| 26 | |
| 27 | @abstractmethod |
| 28 | def parse_document(self, document_path: str, **kwargs) -> List[Dict[str, Any]]: |