Migrate all repos into monorepo context folders
Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)
Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
"""Text extraction layer for various document formats."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from .base import ExtractionResult, TextExtractor
|
||||
from .docx import DocxExtractor
|
||||
from .ocr import OCRExtractor
|
||||
from .pdf import PDFExtractor
|
||||
from .text import PlainTextExtractor
|
||||
|
||||
|
||||
def get_extractor(file_path: Path, config=None):
|
||||
"""Get the appropriate extractor for a file.
|
||||
|
||||
Args:
|
||||
file_path: Path to the file to extract.
|
||||
config: Optional IngestionConfig for LLM-based extraction.
|
||||
|
||||
Returns:
|
||||
An extractor instance that can handle the file, or None.
|
||||
"""
|
||||
suffix = file_path.suffix.lower()
|
||||
|
||||
if suffix in (".md", ".txt"):
|
||||
return PlainTextExtractor()
|
||||
elif suffix == ".pdf":
|
||||
if config:
|
||||
return PDFExtractor(
|
||||
ocr_enabled=config.ocr_enabled,
|
||||
ocr_language=config.ocr_language,
|
||||
llm_provider=config.llm_provider,
|
||||
llm_model=config.llm_model,
|
||||
mistral_api_key=config.mistral_api_key,
|
||||
)
|
||||
return PDFExtractor()
|
||||
elif suffix in (".jpg", ".jpeg", ".png"):
|
||||
return OCRExtractor()
|
||||
elif suffix == ".docx":
|
||||
return DocxExtractor()
|
||||
return None
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ExtractionResult",
|
||||
"TextExtractor",
|
||||
"PlainTextExtractor",
|
||||
"PDFExtractor",
|
||||
"OCRExtractor",
|
||||
"DocxExtractor",
|
||||
"get_extractor",
|
||||
]
|
||||
Reference in New Issue
Block a user