20 lines
523 B
Markdown
20 lines
523 B
Markdown
```kotlin title="Kotlin"
|
|
import dev.kreuzberg.*
|
|
import java.nio.file.Paths
|
|
import java.util.Optional
|
|
|
|
fun main() {
|
|
val tokenReduction = TokenReductionOptions.builder()
|
|
.withMode("moderate")
|
|
.withPreserveImportantWords(true)
|
|
.build()
|
|
|
|
val config = ExtractionConfig.builder()
|
|
.withTokenReduction(Optional.of(tokenReduction))
|
|
.build()
|
|
|
|
val result = Kreuzberg.extractFileSync(Paths.get("document.pdf"), null, config)
|
|
println("Reduced content: ${result.content()}")
|
|
}
|
|
```
|