This commit is contained in:
22
docs/snippets/elixir/advanced/quality_processing_example.md
Normal file
22
docs/snippets/elixir/advanced/quality_processing_example.md
Normal file
@@ -0,0 +1,22 @@
|
||||
```elixir title="Elixir"
|
||||
config_json = Jason.encode!(%{
|
||||
"post_processors" => [
|
||||
%{
|
||||
"name" => "QualityFilter",
|
||||
"enabled" => true
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
{:ok, result_before} = Kreuzberg.extract_file_sync("document.pdf", "application/pdf", nil)
|
||||
|
||||
{:ok, result_after} = Kreuzberg.extract_file_sync("document.pdf", "application/pdf", config_json)
|
||||
|
||||
# Compare text quality metrics
|
||||
text_before = result_before.text || ""
|
||||
text_after = result_after.text || ""
|
||||
|
||||
IO.puts("Before quality processing: #{String.length(text_before)} chars")
|
||||
IO.puts("After quality processing: #{String.length(text_after)} chars")
|
||||
IO.puts("Improvement: #{Float.round((1 - String.length(text_after) / String.length(text_before)) * 100, 2)}%")
|
||||
```
|
||||
Reference in New Issue
Block a user