26 lines
695 B
Markdown
26 lines
695 B
Markdown
```kotlin title="Kotlin"
|
|
import dev.kreuzberg.*
|
|
import java.nio.file.Paths
|
|
import java.util.Optional
|
|
|
|
fun main() {
|
|
val languageDetection = LanguageDetectionConfig.builder()
|
|
.withEnabled(true)
|
|
.withMinConfidence(0.8)
|
|
.withDetectMultiple(true)
|
|
.build()
|
|
|
|
val config = ExtractionConfig.builder()
|
|
.withLanguageDetection(Optional.of(languageDetection))
|
|
.build()
|
|
|
|
val result = Kreuzberg.extractFileSync(Paths.get("multilingual_document.pdf"), null, config)
|
|
|
|
val detected = result.detectedLanguages() ?: emptyList()
|
|
println("Detected languages: $detected")
|
|
for (language in detected) {
|
|
println(" - $language")
|
|
}
|
|
}
|
|
```
|