This commit is contained in:
19
docs/snippets/kotlin/advanced/token_reduction_example.md
Normal file
19
docs/snippets/kotlin/advanced/token_reduction_example.md
Normal file
@@ -0,0 +1,19 @@
|
||||
```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("verbose_document.pdf"), null, config)
|
||||
println("Reduced content length: ${result.content().length}")
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user