automated-document-parser 0.1.4__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- automated_document_parser-0.1.6/.github/workflows/docs.yml +60 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/.gitignore +4 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/.pre-commit-config.yaml +1 -1
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/Makefile +18 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/PKG-INFO +99 -17
- automated_document_parser-0.1.6/README.md +147 -0
- automated_document_parser-0.1.6/docs/.nojekyll +0 -0
- automated_document_parser-0.1.6/docs/Makefile +20 -0
- automated_document_parser-0.1.6/docs/README.md +99 -0
- automated_document_parser-0.1.6/docs/api.rst +188 -0
- automated_document_parser-0.1.6/docs/conf.py +85 -0
- automated_document_parser-0.1.6/docs/index.rst +180 -0
- automated_document_parser-0.1.6/docs/modules.rst +9 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/notebook_examples/rag_example.ipynb +334 -25
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/pyproject.toml +3 -1
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/requirements.txt +33 -1
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/src/automated_document_parser/__init__.py +1 -1
- automated_document_parser-0.1.6/src/automated_document_parser/config.py +88 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/src/automated_document_parser/core.py +31 -7
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/__init__.py +29 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/file_load/__init__.py +30 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/file_load/base.py +53 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/file_load/csv_loader.py +56 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/file_load/docx_loader.py +55 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/file_load/html_loader.py +55 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/file_load/json_loader.py +59 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/file_load/text_loader.py +58 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/file_loaders.py +154 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/__init__.py +47 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/base.py +72 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/loader.py +180 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/mathpix_loader.py +75 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/opendataloader_loader.py +65 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/pdfplumber_loader.py +60 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/pymupdf4llm_loader.py +58 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/pymupdf_loader.py +60 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/pypdf_loader.py +51 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/pypdfium2_loader.py +60 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/textract_loader.py +74 -0
- automated_document_parser-0.1.6/src/automated_document_parser/loaders/pdf_load/unstructured_loader.py +72 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/test/test_file_loaders.py +56 -0
- automated_document_parser-0.1.6/test/test_pdf_loaders.py +825 -0
- automated_document_parser-0.1.4/README.md +0 -67
- automated_document_parser-0.1.4/src/automated_document_parser/config.py +0 -43
- automated_document_parser-0.1.4/src/automated_document_parser/loaders/__init__.py +0 -5
- automated_document_parser-0.1.4/src/automated_document_parser/loaders/base_loader.py +0 -1
- automated_document_parser-0.1.4/src/automated_document_parser/loaders/file_loaders.py +0 -113
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/.github/workflows/ci.yml +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/.github/workflows/publish.yml +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/LICENSE +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/notebook_examples/sample_docs/data.csv +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/notebook_examples/sample_docs/machine_learning.txt +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/notebook_examples/sample_docs/python_basics.txt +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/src/automated_document_parser/main.py +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/src/automated_document_parser/utils.py +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/test/__init__.py +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/test/test_config.py +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/test/test_core.py +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/test/test_main.py +0 -0
- {automated_document_parser-0.1.4 → automated_document_parser-0.1.6}/test/test_utils.py +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: Build and Deploy Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- master
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
pages: write
|
|
15
|
+
id-token: write
|
|
16
|
+
|
|
17
|
+
# Allow only one concurrent deployment
|
|
18
|
+
concurrency:
|
|
19
|
+
group: "pages"
|
|
20
|
+
cancel-in-progress: false
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
build:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout
|
|
27
|
+
uses: actions/checkout@v4
|
|
28
|
+
|
|
29
|
+
- name: Set up Python
|
|
30
|
+
uses: actions/setup-python@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: '3.13'
|
|
33
|
+
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: |
|
|
36
|
+
python -m pip install --upgrade pip
|
|
37
|
+
pip install sphinx sphinx-rtd-theme
|
|
38
|
+
pip install -e .
|
|
39
|
+
|
|
40
|
+
- name: Build documentation
|
|
41
|
+
run: |
|
|
42
|
+
cd docs
|
|
43
|
+
make html
|
|
44
|
+
|
|
45
|
+
- name: Upload artifact
|
|
46
|
+
uses: actions/upload-pages-artifact@v3
|
|
47
|
+
with:
|
|
48
|
+
path: docs/_build/html
|
|
49
|
+
|
|
50
|
+
deploy:
|
|
51
|
+
environment:
|
|
52
|
+
name: github-pages
|
|
53
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
needs: build
|
|
56
|
+
if: github.ref == 'refs/heads/master'
|
|
57
|
+
steps:
|
|
58
|
+
- name: Deploy to GitHub Pages
|
|
59
|
+
id: deployment
|
|
60
|
+
uses: actions/deploy-pages@v4
|
|
@@ -57,3 +57,21 @@ publish-pypi: build
|
|
|
57
57
|
@echo "Published to PyPI!"
|
|
58
58
|
@echo "Install with: pip install automated-document-parser"
|
|
59
59
|
|
|
60
|
+
docs:
|
|
61
|
+
@echo "Building documentation..."
|
|
62
|
+
cd docs && $(MAKE) clean
|
|
63
|
+
cd docs && $(MAKE) html
|
|
64
|
+
@cp docs/.nojekyll docs/_build/html/
|
|
65
|
+
@echo "Documentation built successfully!"
|
|
66
|
+
@echo "Open docs/_build/html/index.html in your browser"
|
|
67
|
+
|
|
68
|
+
docs-clean:
|
|
69
|
+
@echo "Cleaning documentation build..."
|
|
70
|
+
cd docs && $(MAKE) clean
|
|
71
|
+
@echo "Documentation cleaned!"
|
|
72
|
+
|
|
73
|
+
docs-serve:
|
|
74
|
+
@echo "Starting documentation server..."
|
|
75
|
+
@echo "Open http://localhost:8000 in your browser"
|
|
76
|
+
cd docs/_build/html && python -m http.server 8000
|
|
77
|
+
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: automated-document-parser
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: A powerful and automated document parser built with LangChain for intelligent document processing
|
|
5
5
|
Project-URL: Homepage, https://github.com/Pulkit12dhingra/automated-document-parser
|
|
6
|
+
Project-URL: Documentation, https://pulkit12dhingra.github.io/automated-document-parser/
|
|
6
7
|
Project-URL: Repository, https://github.com/Pulkit12dhingra/automated-document-parser
|
|
7
8
|
Project-URL: Issues, https://github.com/Pulkit12dhingra/automated-document-parser/issues
|
|
8
9
|
Author-email: Pulkit Dhingra <pulkit12dhingra@example.com>
|
|
@@ -45,6 +46,7 @@ Requires-Dist: pypdf>=5.1.0
|
|
|
45
46
|
Requires-Dist: python-docx>=1.1.0
|
|
46
47
|
Requires-Dist: python-magic>=0.4.27
|
|
47
48
|
Requires-Dist: sentence-transformers>=5.1.2
|
|
49
|
+
Requires-Dist: sphinx>=8.2.3
|
|
48
50
|
Requires-Dist: torch>=2.9.0
|
|
49
51
|
Requires-Dist: transformers>=4.57.1
|
|
50
52
|
Provides-Extra: dev
|
|
@@ -68,12 +70,39 @@ A powerful and automated document parser built with LangChain for intelligent do
|
|
|
68
70
|
|
|
69
71
|
## Features
|
|
70
72
|
|
|
71
|
-
- Automatic file type detection based on file extensions
|
|
72
|
-
-
|
|
73
|
+
- **Automatic file type detection** based on file extensions
|
|
74
|
+
- **Multiple PDF loading methods** - 9 different PDF loaders for various use cases
|
|
75
|
+
- **Modular architecture** - Clean separation with `file_load/` and `pdf_load/` modules
|
|
76
|
+
- **Support for multiple document formats**: PDF, TXT, CSV, JSON, DOCX, HTML, Markdown
|
|
73
77
|
- Built on LangChain for seamless integration with RAG applications
|
|
74
78
|
- Type-safe implementation with comprehensive error handling
|
|
75
79
|
- Batch processing support for multiple documents
|
|
76
80
|
|
|
81
|
+
## Supported File Types
|
|
82
|
+
|
|
83
|
+
### Text Files
|
|
84
|
+
- `.txt` - Plain text files
|
|
85
|
+
- `.md` - Markdown files
|
|
86
|
+
|
|
87
|
+
### Structured Data
|
|
88
|
+
- `.csv` - CSV files with encoding support
|
|
89
|
+
- `.json` - JSON files with jq schema filtering
|
|
90
|
+
|
|
91
|
+
### Documents
|
|
92
|
+
- `.docx` - Microsoft Word documents
|
|
93
|
+
- `.html` - HTML files
|
|
94
|
+
|
|
95
|
+
### PDF Files (9 loading methods)
|
|
96
|
+
- `pypdf` - Basic PDF text extraction (default, no extra dependencies)
|
|
97
|
+
- `unstructured` - Advanced OCR and layout detection
|
|
98
|
+
- `amazon_textract` - AWS Textract for high-accuracy OCR
|
|
99
|
+
- `mathpix` - Specialized for mathematical formulas
|
|
100
|
+
- `pdfplumber` - High accuracy text and table extraction
|
|
101
|
+
- `pypdfium2` - Google PDFium library
|
|
102
|
+
- `pymupdf` - PyMuPDF (fitz) backend
|
|
103
|
+
- `pymupdf4llm` - LLM-optimized extraction
|
|
104
|
+
- `opendataloader` - Advanced multi-format parsing
|
|
105
|
+
|
|
77
106
|
## Installation
|
|
78
107
|
|
|
79
108
|
Install from PyPI:
|
|
@@ -90,7 +119,9 @@ uv add automated-document-parser
|
|
|
90
119
|
|
|
91
120
|
## Quick Start
|
|
92
121
|
|
|
93
|
-
### Basic Usage
|
|
122
|
+
### Basic Usage - Automatic File Type Detection
|
|
123
|
+
|
|
124
|
+
The primary feature is **automatic file type detection**. Just point to any supported file and the parser handles the rest:
|
|
94
125
|
|
|
95
126
|
```python
|
|
96
127
|
from automated_document_parser import DocumentParser
|
|
@@ -98,27 +129,78 @@ from automated_document_parser import DocumentParser
|
|
|
98
129
|
# Initialize the parser
|
|
99
130
|
parser = DocumentParser()
|
|
100
131
|
|
|
101
|
-
# Parse
|
|
102
|
-
documents = parser.parse("
|
|
103
|
-
|
|
104
|
-
#
|
|
105
|
-
|
|
106
|
-
|
|
132
|
+
# Parse any single file - automatically detects type and uses the right loader
|
|
133
|
+
documents = parser.parse("document.pdf") # Auto-detects PDF
|
|
134
|
+
documents = parser.parse("data.csv") # Auto-detects CSV
|
|
135
|
+
documents = parser.parse("notes.txt") # Auto-detects text file
|
|
136
|
+
|
|
137
|
+
# Parse multiple files of different types - all formats handled automatically
|
|
138
|
+
file_paths = ["report.pdf", "data.csv", "notes.txt", "info.docx"]
|
|
139
|
+
all_docs = parser.parse_multiple(file_paths) # Each file auto-detected and loaded
|
|
140
|
+
|
|
141
|
+
# Access parsed content
|
|
142
|
+
for file_path, docs in all_docs.items():
|
|
143
|
+
print(f"File: {file_path}")
|
|
144
|
+
for doc in docs:
|
|
145
|
+
print(f" Content: {doc.page_content[:100]}...")
|
|
146
|
+
print(f" Metadata: {doc.metadata}")
|
|
107
147
|
```
|
|
108
148
|
|
|
109
|
-
###
|
|
149
|
+
### Specify Loading Methods
|
|
150
|
+
|
|
151
|
+
Specify the PDF loading method and other parameters to apply to all files:
|
|
110
152
|
|
|
111
153
|
```python
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
154
|
+
from automated_document_parser import DocumentParser
|
|
155
|
+
|
|
156
|
+
parser = DocumentParser()
|
|
157
|
+
|
|
158
|
+
# Step 1: Specify the method for PDFs
|
|
159
|
+
# Step 2: Parser automatically detects file types and loads them with specified method
|
|
160
|
+
file_paths = ["report1.pdf", "report2.pdf", "data.csv", "notes.txt"]
|
|
161
|
+
all_docs = parser.parse_multiple(
|
|
162
|
+
file_paths,
|
|
163
|
+
pdf_loader_method="pdfplumber", # All PDFs will use pdfplumber
|
|
164
|
+
encoding="utf-8" # All text files will use UTF-8 encoding
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
# Each file is automatically detected and loaded with the specified settings
|
|
168
|
+
for file_path, docs in all_docs.items():
|
|
169
|
+
print(f"Loaded {file_path}: {len(docs)} documents")
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Documentation
|
|
173
|
+
|
|
174
|
+
Full documentation is available at: https://pulkit12dhingra.github.io/automated-document-parser/
|
|
175
|
+
|
|
176
|
+
## Architecture
|
|
177
|
+
|
|
178
|
+
The library uses a modular architecture:
|
|
179
|
+
|
|
117
180
|
```
|
|
181
|
+
automated_document_parser/
|
|
182
|
+
├── loaders/
|
|
183
|
+
│ ├── file_load/ # File loaders module
|
|
184
|
+
│ │ ├── base.py # Base file loader class
|
|
185
|
+
│ │ ├── text_loader.py # Text file loader
|
|
186
|
+
│ │ ├── csv_loader.py # CSV loader
|
|
187
|
+
│ │ ├── json_loader.py # JSON loader
|
|
188
|
+
│ │ ├── docx_loader.py # DOCX loader
|
|
189
|
+
│ │ └── html_loader.py # HTML loader
|
|
190
|
+
│ ├── pdf_load/ # PDF loaders module
|
|
191
|
+
│ │ ├── base.py # Base PDF loader class
|
|
192
|
+
│ │ ├── pypdf_loader.py
|
|
193
|
+
│ │ ├── mathpix_loader.py
|
|
194
|
+
│ │ ├── pdfplumber_loader.py
|
|
195
|
+
│ │ └── ... (9 PDF loaders total)
|
|
196
|
+
│ └── file_loaders.py # Main orchestrator
|
|
197
|
+
└── core.py # DocumentParser class
|
|
198
|
+
```
|
|
199
|
+
|
|
118
200
|
## License
|
|
119
201
|
|
|
120
202
|
MIT License - see LICENSE file for details.
|
|
121
203
|
|
|
122
204
|
## Contributing
|
|
123
205
|
|
|
124
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
206
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Automated Document Parser
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/automated-document-parser/)
|
|
4
|
+
[](https://pypi.org/project/automated-document-parser/)
|
|
5
|
+
[](https://github.com/Pulkit12dhingra/automated-document-parser/actions/workflows/ci.yml)
|
|
6
|
+
[](https://codecov.io/gh/Pulkit12dhingra/automated-document-parser)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://github.com/astral-sh/ruff)
|
|
9
|
+
|
|
10
|
+
A powerful and automated document parser built with LangChain for intelligent document processing. This library automatically detects file types and uses the appropriate loader to parse documents into LangChain-compatible formats.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Automatic file type detection** based on file extensions
|
|
15
|
+
- **Multiple PDF loading methods** - 9 different PDF loaders for various use cases
|
|
16
|
+
- **Modular architecture** - Clean separation with `file_load/` and `pdf_load/` modules
|
|
17
|
+
- **Support for multiple document formats**: PDF, TXT, CSV, JSON, DOCX, HTML, Markdown
|
|
18
|
+
- Built on LangChain for seamless integration with RAG applications
|
|
19
|
+
- Type-safe implementation with comprehensive error handling
|
|
20
|
+
- Batch processing support for multiple documents
|
|
21
|
+
|
|
22
|
+
## Supported File Types
|
|
23
|
+
|
|
24
|
+
### Text Files
|
|
25
|
+
- `.txt` - Plain text files
|
|
26
|
+
- `.md` - Markdown files
|
|
27
|
+
|
|
28
|
+
### Structured Data
|
|
29
|
+
- `.csv` - CSV files with encoding support
|
|
30
|
+
- `.json` - JSON files with jq schema filtering
|
|
31
|
+
|
|
32
|
+
### Documents
|
|
33
|
+
- `.docx` - Microsoft Word documents
|
|
34
|
+
- `.html` - HTML files
|
|
35
|
+
|
|
36
|
+
### PDF Files (9 loading methods)
|
|
37
|
+
- `pypdf` - Basic PDF text extraction (default, no extra dependencies)
|
|
38
|
+
- `unstructured` - Advanced OCR and layout detection
|
|
39
|
+
- `amazon_textract` - AWS Textract for high-accuracy OCR
|
|
40
|
+
- `mathpix` - Specialized for mathematical formulas
|
|
41
|
+
- `pdfplumber` - High accuracy text and table extraction
|
|
42
|
+
- `pypdfium2` - Google PDFium library
|
|
43
|
+
- `pymupdf` - PyMuPDF (fitz) backend
|
|
44
|
+
- `pymupdf4llm` - LLM-optimized extraction
|
|
45
|
+
- `opendataloader` - Advanced multi-format parsing
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
Install from PyPI:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install automated-document-parser
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or using uv:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
uv add automated-document-parser
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Quick Start
|
|
62
|
+
|
|
63
|
+
### Basic Usage - Automatic File Type Detection
|
|
64
|
+
|
|
65
|
+
The primary feature is **automatic file type detection**. Just point to any supported file and the parser handles the rest:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from automated_document_parser import DocumentParser
|
|
69
|
+
|
|
70
|
+
# Initialize the parser
|
|
71
|
+
parser = DocumentParser()
|
|
72
|
+
|
|
73
|
+
# Parse any single file - automatically detects type and uses the right loader
|
|
74
|
+
documents = parser.parse("document.pdf") # Auto-detects PDF
|
|
75
|
+
documents = parser.parse("data.csv") # Auto-detects CSV
|
|
76
|
+
documents = parser.parse("notes.txt") # Auto-detects text file
|
|
77
|
+
|
|
78
|
+
# Parse multiple files of different types - all formats handled automatically
|
|
79
|
+
file_paths = ["report.pdf", "data.csv", "notes.txt", "info.docx"]
|
|
80
|
+
all_docs = parser.parse_multiple(file_paths) # Each file auto-detected and loaded
|
|
81
|
+
|
|
82
|
+
# Access parsed content
|
|
83
|
+
for file_path, docs in all_docs.items():
|
|
84
|
+
print(f"File: {file_path}")
|
|
85
|
+
for doc in docs:
|
|
86
|
+
print(f" Content: {doc.page_content[:100]}...")
|
|
87
|
+
print(f" Metadata: {doc.metadata}")
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Specify Loading Methods
|
|
91
|
+
|
|
92
|
+
Specify the PDF loading method and other parameters to apply to all files:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from automated_document_parser import DocumentParser
|
|
96
|
+
|
|
97
|
+
parser = DocumentParser()
|
|
98
|
+
|
|
99
|
+
# Step 1: Specify the method for PDFs
|
|
100
|
+
# Step 2: Parser automatically detects file types and loads them with specified method
|
|
101
|
+
file_paths = ["report1.pdf", "report2.pdf", "data.csv", "notes.txt"]
|
|
102
|
+
all_docs = parser.parse_multiple(
|
|
103
|
+
file_paths,
|
|
104
|
+
pdf_loader_method="pdfplumber", # All PDFs will use pdfplumber
|
|
105
|
+
encoding="utf-8" # All text files will use UTF-8 encoding
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
# Each file is automatically detected and loaded with the specified settings
|
|
109
|
+
for file_path, docs in all_docs.items():
|
|
110
|
+
print(f"Loaded {file_path}: {len(docs)} documents")
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Documentation
|
|
114
|
+
|
|
115
|
+
Full documentation is available at: https://pulkit12dhingra.github.io/automated-document-parser/
|
|
116
|
+
|
|
117
|
+
## Architecture
|
|
118
|
+
|
|
119
|
+
The library uses a modular architecture:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
automated_document_parser/
|
|
123
|
+
├── loaders/
|
|
124
|
+
│ ├── file_load/ # File loaders module
|
|
125
|
+
│ │ ├── base.py # Base file loader class
|
|
126
|
+
│ │ ├── text_loader.py # Text file loader
|
|
127
|
+
│ │ ├── csv_loader.py # CSV loader
|
|
128
|
+
│ │ ├── json_loader.py # JSON loader
|
|
129
|
+
│ │ ├── docx_loader.py # DOCX loader
|
|
130
|
+
│ │ └── html_loader.py # HTML loader
|
|
131
|
+
│ ├── pdf_load/ # PDF loaders module
|
|
132
|
+
│ │ ├── base.py # Base PDF loader class
|
|
133
|
+
│ │ ├── pypdf_loader.py
|
|
134
|
+
│ │ ├── mathpix_loader.py
|
|
135
|
+
│ │ ├── pdfplumber_loader.py
|
|
136
|
+
│ │ └── ... (9 PDF loaders total)
|
|
137
|
+
│ └── file_loaders.py # Main orchestrator
|
|
138
|
+
└── core.py # DocumentParser class
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
MIT License - see LICENSE file for details.
|
|
144
|
+
|
|
145
|
+
## Contributing
|
|
146
|
+
|
|
147
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = .
|
|
9
|
+
BUILDDIR = _build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Documentation
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
This directory contains the source files for building the Automated Document Parser documentation using Sphinx.
|
|
5
|
+
|
|
6
|
+
Building the Documentation
|
|
7
|
+
---------------------------
|
|
8
|
+
|
|
9
|
+
To build the HTML documentation:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# From the project root
|
|
13
|
+
make docs
|
|
14
|
+
|
|
15
|
+
# Or from the docs/ directory
|
|
16
|
+
cd docs
|
|
17
|
+
make html
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The generated HTML files will be in `docs/_build/html/`.
|
|
21
|
+
|
|
22
|
+
Viewing the Documentation
|
|
23
|
+
--------------------------
|
|
24
|
+
|
|
25
|
+
After building, you can:
|
|
26
|
+
|
|
27
|
+
1. **Open directly in browser:**
|
|
28
|
+
```bash
|
|
29
|
+
open docs/_build/html/index.html
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
2. **Start a local server:**
|
|
33
|
+
```bash
|
|
34
|
+
make docs-serve
|
|
35
|
+
# Then open http://localhost:8000 in your browser
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Documentation Structure
|
|
39
|
+
-----------------------
|
|
40
|
+
|
|
41
|
+
- `conf.py` - Sphinx configuration file
|
|
42
|
+
- `index.rst` - Main documentation homepage
|
|
43
|
+
- `api.rst` - Complete API reference with autodoc
|
|
44
|
+
- `modules.rst` - Auto-generated module documentation
|
|
45
|
+
- `_static/` - Static files (CSS, images, etc.)
|
|
46
|
+
- `_templates/` - Custom templates
|
|
47
|
+
- `_build/` - Generated documentation (not in git)
|
|
48
|
+
|
|
49
|
+
Makefile Commands
|
|
50
|
+
-----------------
|
|
51
|
+
|
|
52
|
+
From the project root:
|
|
53
|
+
|
|
54
|
+
- `make docs` - Build HTML documentation
|
|
55
|
+
- `make docs-clean` - Clean build directory
|
|
56
|
+
- `make docs-serve` - Start local documentation server
|
|
57
|
+
|
|
58
|
+
From the docs/ directory:
|
|
59
|
+
|
|
60
|
+
- `make html` - Build HTML documentation
|
|
61
|
+
- `make clean` - Clean build directory
|
|
62
|
+
- `make help` - Show all available commands
|
|
63
|
+
|
|
64
|
+
Sphinx Extensions
|
|
65
|
+
-----------------
|
|
66
|
+
|
|
67
|
+
The documentation uses these Sphinx extensions:
|
|
68
|
+
|
|
69
|
+
- **autodoc** - Auto-generate docs from docstrings
|
|
70
|
+
- **napoleon** - Support for Google and NumPy style docstrings
|
|
71
|
+
- **viewcode** - Add links to highlighted source code
|
|
72
|
+
- **intersphinx** - Link to other project documentation
|
|
73
|
+
- **autosummary** - Generate autodoc summaries
|
|
74
|
+
|
|
75
|
+
Theme
|
|
76
|
+
-----
|
|
77
|
+
|
|
78
|
+
Uses the [Read the Docs Sphinx Theme](https://github.com/readthedocs/sphinx_rtd_theme).
|
|
79
|
+
|
|
80
|
+
To install: `uv pip install sphinx-rtd-theme`
|
|
81
|
+
|
|
82
|
+
Contributing to Documentation
|
|
83
|
+
------------------------------
|
|
84
|
+
|
|
85
|
+
When adding new modules or functions, make sure to:
|
|
86
|
+
|
|
87
|
+
1. Write clear docstrings using Google or NumPy style
|
|
88
|
+
2. Include parameter types and return types
|
|
89
|
+
3. Add usage examples where appropriate
|
|
90
|
+
4. Rebuild docs to verify formatting: `make docs`
|
|
91
|
+
|
|
92
|
+
Hosting
|
|
93
|
+
-------
|
|
94
|
+
|
|
95
|
+
The documentation can be easily hosted on:
|
|
96
|
+
|
|
97
|
+
- **Read the Docs** - Connect your GitHub repo
|
|
98
|
+
- **GitHub Pages** - Use `docs/_build/html/` directory
|
|
99
|
+
- **Any static hosting** - Deploy the `_build/html/` folder
|