This commit is contained in:
29
docs/snippets/python/advanced/advanced_config.md
Normal file
29
docs/snippets/python/advanced/advanced_config.md
Normal file
@@ -0,0 +1,29 @@
|
||||
```python title="Python"
|
||||
from kreuzberg import (
|
||||
extract_file_sync,
|
||||
ExtractionConfig,
|
||||
OcrConfig,
|
||||
ChunkingConfig,
|
||||
TokenReductionConfig,
|
||||
LanguageDetectionConfig,
|
||||
)
|
||||
|
||||
config = ExtractionConfig(
|
||||
ocr=OcrConfig(backend="tesseract", language="eng+deu"),
|
||||
chunking=ChunkingConfig(max_chars=1000, max_overlap=100),
|
||||
token_reduction=TokenReductionConfig(mode="light"),
|
||||
language_detection=LanguageDetectionConfig(
|
||||
enabled=True, detect_multiple=True
|
||||
),
|
||||
use_cache=True,
|
||||
enable_quality_processing=True,
|
||||
)
|
||||
|
||||
result = extract_file_sync("document.pdf", config=config)
|
||||
|
||||
for chunk in result.chunks or []:
|
||||
print(f"Chunk: {chunk.content[:100]}")
|
||||
|
||||
if result.detected_languages:
|
||||
print(f"Languages: {result.detected_languages}")
|
||||
```
|
||||
Reference in New Issue
Block a user