This commit is contained in:
22
docs/snippets/rust/utils/quality_processing_example.md
Normal file
22
docs/snippets/rust/utils/quality_processing_example.md
Normal file
@@ -0,0 +1,22 @@
|
||||
```rust title="Rust"
|
||||
use kreuzberg::{extract_file, ExtractionConfig};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> kreuzberg::Result<()> {
|
||||
let config = ExtractionConfig {
|
||||
enable_quality_processing: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let result = extract_file("scanned_document.pdf", None, &config).await?;
|
||||
let quality_score = result.quality_score.unwrap_or(0.0);
|
||||
|
||||
if quality_score < 0.5 {
|
||||
println!("Warning: Low quality extraction ({quality_score:.2})");
|
||||
println!("Consider re-scanning with higher DPI or adjusting OCR settings");
|
||||
} else {
|
||||
println!("Quality score: {quality_score:.2}");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user