MCPcopy Create free account
hub / github.com/DasyDong/developer-roadmap / FormalParserInterface

Class FormalParserInterface

code/interface.py:140–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138
139import abc
140class FormalParserInterface(metaclass=abc.ABCMeta):
141 @classmethod
142 def __subclasshook__(cls, subclass):
143 return (hasattr(subclass, 'load_data_source') and
144 callable(subclass.load_data_source) and
145 hasattr(subclass, 'extract_text') and
146 callable(subclass.extract_text) or
147 NotImplemented)
148
149 @abc.abstractmethod
150 def load_data_source(self, path: str, file_name: str):
151 """Load in the data set"""
152 raise NotImplementedError
153
154 @abc.abstractmethod
155 def extract_text(self, full_file_path: str):
156 """Extract text from the data set"""
157 raise NotImplementedError
158
159class PdfParserNew(FormalParserInterface):
160 """Extract text from a PDF."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected