This commit is contained in:
22
docs/snippets/kotlin/advanced/quality_processing_example.md
Normal file
22
docs/snippets/kotlin/advanced/quality_processing_example.md
Normal file
@@ -0,0 +1,22 @@
|
||||
```kotlin title="Kotlin"
|
||||
import dev.kreuzberg.*
|
||||
import java.nio.file.Paths
|
||||
import java.util.Optional
|
||||
|
||||
fun main() {
|
||||
val config = ExtractionConfig.builder()
|
||||
.withEnableQualityProcessing(true)
|
||||
.build()
|
||||
|
||||
val result = Kreuzberg.extractFileSync(Paths.get("scanned_document.pdf"), null, config)
|
||||
|
||||
val score = result.qualityScore()
|
||||
if (score != null) {
|
||||
if (score < 0.5) {
|
||||
println("Warning: Low quality extraction (%.2f)".format(score))
|
||||
} else {
|
||||
println("Quality score: %.2f".format(score))
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user