This commit is contained in:
32
docs/snippets/kotlin/config/config_programmatic.md
Normal file
32
docs/snippets/kotlin/config/config_programmatic.md
Normal file
@@ -0,0 +1,32 @@
|
||||
```kotlin title="Kotlin"
|
||||
import dev.kreuzberg.*
|
||||
import java.nio.file.Paths
|
||||
import java.util.Optional
|
||||
|
||||
fun main() {
|
||||
val tesseract = TesseractConfig.builder()
|
||||
.withPsm(6)
|
||||
.build()
|
||||
|
||||
val ocr = OcrConfig.builder()
|
||||
.withBackend("tesseract")
|
||||
.withLanguage("eng+deu")
|
||||
.withTesseractConfig(Optional.of(tesseract))
|
||||
.build()
|
||||
|
||||
val chunking = ChunkingConfig.builder()
|
||||
.withMaxCharacters(1000L)
|
||||
.withOverlap(200L)
|
||||
.build()
|
||||
|
||||
val config = ExtractionConfig.builder()
|
||||
.withUseCache(true)
|
||||
.withOcr(Optional.of(ocr))
|
||||
.withChunking(Optional.of(chunking))
|
||||
.withEnableQualityProcessing(true)
|
||||
.build()
|
||||
|
||||
val result = Kreuzberg.extractFileSync(Paths.get("document.pdf"), null, config)
|
||||
println("Content length: ${result.content().length}")
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user