This commit is contained in:
26
docs/snippets/swift/utils/keyword_extraction_example.md
Normal file
26
docs/snippets/swift/utils/keyword_extraction_example.md
Normal file
@@ -0,0 +1,26 @@
|
||||
```swift title="Swift"
|
||||
import Foundation
|
||||
import Kreuzberg
|
||||
import RustBridge
|
||||
|
||||
let configJson = """
|
||||
{
|
||||
"keywords": {
|
||||
"algorithm": "yake",
|
||||
"max_keywords": 10,
|
||||
"min_score": 0.3
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
let config = try extractionConfigFromJson(configJson)
|
||||
let result = try extractFileSync("research_paper.pdf", nil, config)
|
||||
|
||||
if let keywords = result.extracted_keywords() {
|
||||
for keyword in keywords {
|
||||
let text = keyword.text().toString()
|
||||
let score = keyword.score()
|
||||
print("\(text) (score: \(score))")
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user