content-extraction 0.1.0__tar.gz → 0.2.0__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.
Files changed (23) hide show
  1. {content_extraction-0.1.0 → content_extraction-0.2.0}/PKG-INFO +1 -1
  2. {content_extraction-0.1.0 → content_extraction-0.2.0}/pyproject.toml +2 -1
  3. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/file_handlers.py +1 -1
  4. content_extraction-0.2.0/src/content_extraction/process.py +59 -0
  5. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction.egg-info/PKG-INFO +1 -1
  6. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction.egg-info/SOURCES.txt +1 -0
  7. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction.egg-info/top_level.txt +0 -1
  8. {content_extraction-0.1.0 → content_extraction-0.2.0}/README.md +0 -0
  9. {content_extraction-0.1.0 → content_extraction-0.2.0}/setup.cfg +0 -0
  10. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/__init__.py +0 -0
  11. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/common_std_io.py +0 -0
  12. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/do_ocr.py +0 -0
  13. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/dspy_modules.py +0 -0
  14. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/extract_from_pptx.py +0 -0
  15. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/fix_ocr.py +0 -0
  16. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/logging_config.py +0 -0
  17. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/parse_html.py +0 -0
  18. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/semantic_chunk_html.py +0 -0
  19. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction/split_and_create_digest.py +0 -0
  20. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction.egg-info/dependency_links.txt +0 -0
  21. {content_extraction-0.1.0 → content_extraction-0.2.0}/src/content_extraction.egg-info/requires.txt +0 -0
  22. {content_extraction-0.1.0 → content_extraction-0.2.0}/tests/test_section_parser.py +0 -0
  23. {content_extraction-0.1.0 → content_extraction-0.2.0}/tests/test_semantic_chunk_html.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: content_extraction
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Project dedicated to content extraction from unstructured files that contain some useful information.
5
5
  Requires-Python: >=3.13
6
6
  Description-Content-Type: text/markdown
@@ -7,7 +7,7 @@ where = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "content_extraction"
10
- version = "0.1.0"
10
+ version = "0.2.0"
11
11
  description = "Project dedicated to content extraction from unstructured files that contain some useful information."
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.13"
@@ -17,6 +17,7 @@ dependencies = ["beautifulsoup4>=4.13.4", "lxml>=6.0.0", "python-pptx>=1.0.2"]
17
17
  dev = [
18
18
  "dspy>=2.6.27",
19
19
  "jupyterlab>=4.4.5",
20
+ "mypy>=1.17.0",
20
21
  "pre-commit>=4.2.0",
21
22
  "pyright>=1.1.403",
22
23
  "pytest>=8.4.1",
@@ -50,7 +50,7 @@ def process_pdf(file_path: str, output_dir: str):
50
50
  """
51
51
  logger.info(f'[Processing PDF file] started for: "{file_path}"')
52
52
  # This path assumes the script is located at src/scripts/process_document.sh
53
- script_path = os.path.join(os.path.dirname(__file__), '..', 'scripts', 'process_document.sh')
53
+ script_path = os.path.join(os.path.dirname(__file__), 'process_document.sh')
54
54
  output_html_path = os.path.join(output_dir, 'index.html') # Define output_html_path
55
55
  logger.debug(f'[Processing PDF file] script path: "{script_path}"; output_html_path: "{output_html_path}"')
56
56
 
@@ -0,0 +1,59 @@
1
+ import argparse
2
+ import sys
3
+ import logging
4
+
5
+ from content_extraction.logging_config import setup_logging
6
+ from content_extraction.file_handlers import process_file
7
+
8
+
9
+ logger = logging.getLogger(__name__)
10
+
11
+
12
+ def main():
13
+ """
14
+ Main function to process the input file/URL and generate structured output.
15
+ """
16
+ setup_logging()
17
+ parser = argparse.ArgumentParser(
18
+ description='Process various document types (PDF, PPTX, DOCX, MD, HTML, URL) and extract content into a structured HTML format.',
19
+ formatter_class=argparse.RawDescriptionHelpFormatter,
20
+ epilog="""
21
+ Examples:
22
+ # Run from the project root directory (`content-extraction/`)
23
+
24
+ # Process a local PDF file
25
+ python src/process.py my_document.pdf -o ./output_folder
26
+
27
+ # Process a PowerPoint file silently
28
+ python src/process.py my_slides.pptx --silent
29
+
30
+ # Process a remote URL, letting the script determine the type
31
+ python src/process.py https://example.com/document.pdf
32
+
33
+ # Process a remote URL, forcing the type to be treated as HTML
34
+ python src/process.py https://example.com/some-page --force-ext html
35
+ """,
36
+ )
37
+
38
+ parser.add_argument('input_path', help='Path to the input file or a URL to process.')
39
+ parser.add_argument(
40
+ '-o',
41
+ '--output',
42
+ default='output',
43
+ help="Path to the output directory (defaults to 'output').",
44
+ )
45
+ parser.add_argument(
46
+ '--force-ext',
47
+ default=None,
48
+ help="Force the handler for a specific file extension (e.g., 'pdf', 'pptx') when auto-detection is ambiguous or incorrect.",
49
+ )
50
+
51
+ args = parser.parse_args()
52
+
53
+ logger.info(f'Processing file: {args.input_path}')
54
+ process_file(args.input_path, args.output, args.force_ext)
55
+ logger.info('Processing complete.')
56
+
57
+
58
+ if __name__ == '__main__':
59
+ sys.exit(main())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: content_extraction
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Project dedicated to content extraction from unstructured files that contain some useful information.
5
5
  Requires-Python: >=3.13
6
6
  Description-Content-Type: text/markdown
@@ -9,6 +9,7 @@ src/content_extraction/file_handlers.py
9
9
  src/content_extraction/fix_ocr.py
10
10
  src/content_extraction/logging_config.py
11
11
  src/content_extraction/parse_html.py
12
+ src/content_extraction/process.py
12
13
  src/content_extraction/semantic_chunk_html.py
13
14
  src/content_extraction/split_and_create_digest.py
14
15
  src/content_extraction.egg-info/PKG-INFO