This commit is contained in:
22
docs/snippets/kotlin/utils/keyword_extraction_example.md
Normal file
22
docs/snippets/kotlin/utils/keyword_extraction_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 keywords = KeywordConfig.builder()
|
||||
.withAlgorithm(KeywordAlgorithm.Yake)
|
||||
.withMaxKeywords(10L)
|
||||
.withMinScore(0.3f)
|
||||
.build()
|
||||
|
||||
val config = ExtractionConfig.builder()
|
||||
.withKeywords(Optional.of(keywords))
|
||||
.build()
|
||||
|
||||
val result = Kreuzberg.extractFileSync(Paths.get("research_paper.pdf"), null, config)
|
||||
result.extractedKeywords()?.let { extracted ->
|
||||
println("Keywords: $extracted")
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user