PdfMinerExtractor
DashAI.back.models.RAG.extractors.PdfMinerExtractor
PDF text extractor using the pdfminer.six library.
Layout analysis is tunable, which matters on multi-column documents where a plain content-stream dump interleaves the columns.
Parameters
- password : string, default=
- Password for encrypted PDFs. Leave empty for unencrypted files.
- line_margin : number, default=
0.5 - Vertical gap, as a fraction of line height, below which two lines belong to the same paragraph. Raise it to merge tight line spacing.
- char_margin : number, default=
2.0 - Horizontal gap, as a fraction of character width, below which two characters belong to the same word. Lower it to split joined text.
- boxes_flow : number, default=
0.5 - How much reading order follows horizontal position over vertical position. -1.0 is strictly left to right, 1.0 strictly top to bottom.
- detect_vertical : boolean, default=
False - Detect vertically written text, as used in CJK layouts.
Methods
extract(self, file_path: str) -> str
PdfMinerExtractorExtract text from the given file.
get_credential(self, name: str)
ConfigObjectResolve a registered credential component by name.
Parameters
- name : str
- Credential component class name (e.g. "HuggingFaceCredential").
Returns
- BaseCredential
- An instance of the requested credential component.
get_metadata(cls) -> Dict[str, object]
BaseExtractorReturn metadata for registry — primarily supported_file_types.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.
Parameters
- raw_data : dict
- A dictionary with the data provided by the user to initialize the model.
Returns
- dict
- A validated dictionary with the necessary objects.