This commit is contained in:
28
docs/snippets/elixir/configuration/config_ocr.exs
Normal file
28
docs/snippets/elixir/configuration/config_ocr.exs
Normal file
@@ -0,0 +1,28 @@
|
||||
```elixir title="Elixir"
|
||||
alias Kreuzberg.ExtractionConfig
|
||||
|
||||
# Configure OCR-specific settings
|
||||
# Includes backend selection, language settings, and preprocessing options
|
||||
config = %ExtractionConfig{
|
||||
ocr: %{
|
||||
"enabled" => true,
|
||||
"backend" => "tesseract",
|
||||
"language" => "eng",
|
||||
"preprocessing" => true
|
||||
},
|
||||
chunking: %{
|
||||
"max_characters" => 2000,
|
||||
"overlap" => 200
|
||||
},
|
||||
use_cache: true,
|
||||
force_ocr: false
|
||||
}
|
||||
|
||||
{:ok, result} = Kreuzberg.extract_file("scanned_document.pdf", nil, config)
|
||||
|
||||
IO.puts("OCR Configuration Applied:")
|
||||
IO.puts("Backend: tesseract")
|
||||
IO.puts("Language: eng")
|
||||
IO.puts("Content extracted: #{byte_size(result.content)} bytes")
|
||||
IO.puts("Metadata: #{inspect(result.metadata)}")
|
||||
```
|
||||
Reference in New Issue
Block a user