https://github.com/jsv4/pdf-preprocessors
Collection of tools to provide text extract outputs for all PDFs that include x,y coordinate data as well as text
https://github.com/jsv4/pdf-preprocessors
Last synced: 3 months ago
JSON representation
Collection of tools to provide text extract outputs for all PDFs that include x,y coordinate data as well as text
- Host: GitHub
- URL: https://github.com/jsv4/pdf-preprocessors
- Owner: JSv4
- License: apache-2.0
- Created: 2023-09-13T03:37:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-13T04:16:41.000Z (over 1 year ago)
- Last Synced: 2025-01-20T17:50:39.820Z (4 months ago)
- Language: Python
- Size: 14.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# PDF Text Annotation Extractor with Tesseract
## Description
This Python script is based on Allen AI's PAWLs project and is designed to perform OCR on PDF files to extract textual annotations present in each page. It leverages the pytesseract OCR engine. The output generated is aimed to be consistent across documents, making it ideal for machine learning training data, analytics, and other applications requiring standardized, high-quality text extraction.While the PAWLs project offers a powerful preprocessor for handling PDFs, it is not actively maintained. Therefore, this separate project has been initiated to fill that gap and to continuously provide a reliable text extraction solution. Future updates plan to introduce additional preprocessors based on other underlying PDF engines.
## Requirements
- Python 3.9
- pytesseract
- pdf2image
- pandas### Installation
Install the required Python packages using pip (from repo root):
```commandline
cd pdfpreprocessor
pip install .
```## Development
Run linter (after install dependencies):
```commandline
hatch run lint:fmt
```## Usage
To run the script, simply call the `process_tesseract` function, passing in the PDF file's path as an argument:
\`\`\`python
from preprocessors.tesseract import process_tesseractannotations = process_tesseract("path/to/your/pdf/file.pdf")
\`\`\`## Testing
Unit tests should be written to cover each of these functions. Testing can help ensure that the OCR extraction and scaling logic work as expected.
## Contributing
Please read `CONTRIBUTING.md` for details on our code of conduct, and the process for submitting pull requests to us.
## License
This project is licensed under the Apache-2 License - see the `LICENSE.md` file for details.