HowdenParser 0.1.4__tar.gz → 0.1.8__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.
- howdenparser-0.1.8/HowdenParser/parameter/__init__.py +15 -0
- howdenparser-0.1.8/PKG-INFO +83 -0
- howdenparser-0.1.8/README.md +55 -0
- {howdenparser-0.1.4 → howdenparser-0.1.8}/pyproject.toml +3 -1
- howdenparser-0.1.4/HowdenParser/parameter/__init__.py +0 -3
- howdenparser-0.1.4/PKG-INFO +0 -28
- howdenparser-0.1.4/README.md +0 -1
- {howdenparser-0.1.4 → howdenparser-0.1.8}/HowdenParser/__init__.py +0 -0
- {howdenparser-0.1.4 → howdenparser-0.1.8}/HowdenParser/parameter/huggingface.py +0 -0
- {howdenparser-0.1.4 → howdenparser-0.1.8}/HowdenParser/parameter/llamaparser.py +0 -0
- {howdenparser-0.1.4 → howdenparser-0.1.8}/HowdenParser/parameter/mistralocr.py +0 -0
- {howdenparser-0.1.4 → howdenparser-0.1.8}/HowdenParser/parser.py +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import importlib
|
|
3
|
+
|
|
4
|
+
# Get all .py files in this folder except __init__.py
|
|
5
|
+
current_dir = os.path.dirname(__file__)
|
|
6
|
+
for filename in os.listdir(current_dir):
|
|
7
|
+
if filename.endswith(".py") and filename != "__init__.py":
|
|
8
|
+
module_name = filename[:-3] # remove .py
|
|
9
|
+
module = importlib.import_module(f".{module_name}", package=__name__)
|
|
10
|
+
|
|
11
|
+
# Add all classes from the module to the package namespace
|
|
12
|
+
for attr_name in dir(module):
|
|
13
|
+
attr = getattr(module, attr_name)
|
|
14
|
+
if isinstance(attr, type): # only classes
|
|
15
|
+
globals()[attr_name] = attr
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: HowdenParser
|
|
3
|
+
Version: 0.1.8
|
|
4
|
+
Summary: A simple configuration manager with Pydantic and JSON export.
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: config,configuration,pydantic,json
|
|
7
|
+
Author: JesperThoftIllemannJ
|
|
8
|
+
Author-email: jesper.jaeger@howdendanmark.dk
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 2
|
|
11
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.4
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Project-URL: Documentation, https://github.com/yourusername/config
|
|
24
|
+
Project-URL: Homepage, https://github.com/yourusername/config
|
|
25
|
+
Project-URL: Repository, https://github.com/yourusername/config
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# OCR & LLM Parser
|
|
29
|
+
|
|
30
|
+
A powerful Python package for parsing and processing documents using multiple providers:
|
|
31
|
+
- **Mistral OCR** — Extracts text from PDFs and images with high accuracy.
|
|
32
|
+
- **LangChain** — Processes or summarizes text using LLMs.
|
|
33
|
+
- **Llama Parser** — Advanced parsing with Markdown or text output.
|
|
34
|
+
- **HuggingFace** — OCR and document question answering with transformer models.
|
|
35
|
+
|
|
36
|
+
The package provides a **unified interface** so you can switch between providers easily using a **factory pattern**.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🚀 Features
|
|
41
|
+
- Extract text from PDFs or images
|
|
42
|
+
- Summarize or process text using LLMs
|
|
43
|
+
- Support for **Markdown** or **plain text** output
|
|
44
|
+
- Plug-and-play factory to switch providers without changing much code
|
|
45
|
+
- Handles environment variable loading for API keys automatically
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
# 🔑 Tokens
|
|
50
|
+
|
|
51
|
+
Create a .env file in your project root and add the API keys for the services you want to use.
|
|
52
|
+
|
|
53
|
+
### Mistral OCR
|
|
54
|
+
MISTRAL-OCR-API-TOKEN=your_mistral_api_key
|
|
55
|
+
|
|
56
|
+
### Llama Parser
|
|
57
|
+
LLAMA-PARSER-API-TOKEN=your_llama_parser_api_key
|
|
58
|
+
|
|
59
|
+
### HuggingFace
|
|
60
|
+
HF-API-TOKEN=your_huggingface_api_key
|
|
61
|
+
|
|
62
|
+
Only include the keys for the providers you plan to use.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
# 🛠️ Usage
|
|
67
|
+
|
|
68
|
+
from HowdenParser import ParserFactory
|
|
69
|
+
|
|
70
|
+
from pathlib import Path
|
|
71
|
+
|
|
72
|
+
parser = ParserFactory.get_parser("mistralocr:", result_type="md")
|
|
73
|
+
text = parser.parse(Path("document.pdf"))
|
|
74
|
+
print(text)
|
|
75
|
+
|
|
76
|
+
if HowdenConfig package being used
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
parser = ParserFactory.get_parser("mistralocr:", **config.parameter.dump_model())
|
|
80
|
+
|
|
81
|
+
text = parser.parse(Path("document.pdf"))
|
|
82
|
+
|
|
83
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# OCR & LLM Parser
|
|
2
|
+
|
|
3
|
+
A powerful Python package for parsing and processing documents using multiple providers:
|
|
4
|
+
- **Mistral OCR** — Extracts text from PDFs and images with high accuracy.
|
|
5
|
+
- **LangChain** — Processes or summarizes text using LLMs.
|
|
6
|
+
- **Llama Parser** — Advanced parsing with Markdown or text output.
|
|
7
|
+
- **HuggingFace** — OCR and document question answering with transformer models.
|
|
8
|
+
|
|
9
|
+
The package provides a **unified interface** so you can switch between providers easily using a **factory pattern**.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 🚀 Features
|
|
14
|
+
- Extract text from PDFs or images
|
|
15
|
+
- Summarize or process text using LLMs
|
|
16
|
+
- Support for **Markdown** or **plain text** output
|
|
17
|
+
- Plug-and-play factory to switch providers without changing much code
|
|
18
|
+
- Handles environment variable loading for API keys automatically
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# 🔑 Tokens
|
|
23
|
+
|
|
24
|
+
Create a .env file in your project root and add the API keys for the services you want to use.
|
|
25
|
+
|
|
26
|
+
### Mistral OCR
|
|
27
|
+
MISTRAL-OCR-API-TOKEN=your_mistral_api_key
|
|
28
|
+
|
|
29
|
+
### Llama Parser
|
|
30
|
+
LLAMA-PARSER-API-TOKEN=your_llama_parser_api_key
|
|
31
|
+
|
|
32
|
+
### HuggingFace
|
|
33
|
+
HF-API-TOKEN=your_huggingface_api_key
|
|
34
|
+
|
|
35
|
+
Only include the keys for the providers you plan to use.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# 🛠️ Usage
|
|
40
|
+
|
|
41
|
+
from HowdenParser import ParserFactory
|
|
42
|
+
|
|
43
|
+
from pathlib import Path
|
|
44
|
+
|
|
45
|
+
parser = ParserFactory.get_parser("mistralocr:", result_type="md")
|
|
46
|
+
text = parser.parse(Path("document.pdf"))
|
|
47
|
+
print(text)
|
|
48
|
+
|
|
49
|
+
if HowdenConfig package being used
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
parser = ParserFactory.get_parser("mistralocr:", **config.parameter.dump_model())
|
|
53
|
+
|
|
54
|
+
text = parser.parse(Path("document.pdf"))
|
|
55
|
+
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "HowdenParser"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.8"
|
|
8
8
|
description = "A simple configuration manager with Pydantic and JSON export."
|
|
9
9
|
authors = [ "JesperThoftIllemannJ <jesper.jaeger@howdendanmark.dk>",]
|
|
10
10
|
readme = "README.md"
|
|
@@ -16,3 +16,5 @@ documentation = "https://github.com/yourusername/config"
|
|
|
16
16
|
[[tool.poetry.packages]]
|
|
17
17
|
include = "HowdenParser"
|
|
18
18
|
|
|
19
|
+
[tool.poetry.group.dev.dependencies]
|
|
20
|
+
toml = "^0.10.2"
|
howdenparser-0.1.4/PKG-INFO
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: HowdenParser
|
|
3
|
-
Version: 0.1.4
|
|
4
|
-
Summary: A simple configuration manager with Pydantic and JSON export.
|
|
5
|
-
License: MIT
|
|
6
|
-
Keywords: config,configuration,pydantic,json
|
|
7
|
-
Author: JesperThoftIllemannJ
|
|
8
|
-
Author-email: jesper.jaeger@howdendanmark.dk
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Programming Language :: Python :: 2
|
|
11
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.4
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
-
Project-URL: Documentation, https://github.com/yourusername/config
|
|
24
|
-
Project-URL: Homepage, https://github.com/yourusername/config
|
|
25
|
-
Project-URL: Repository, https://github.com/yourusername/config
|
|
26
|
-
Description-Content-Type: text/markdown
|
|
27
|
-
|
|
28
|
-
.\build.ps1
|
howdenparser-0.1.4/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.\build.ps1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|