22 lines
454 B
Markdown
22 lines
454 B
Markdown
|
|
```swift title="Swift"
|
||
|
|
import Foundation
|
||
|
|
import Kreuzberg
|
||
|
|
import RustBridge
|
||
|
|
|
||
|
|
let configJson = """
|
||
|
|
{
|
||
|
|
"token_reduction": {
|
||
|
|
"mode": "moderate",
|
||
|
|
"preserve_markdown": true,
|
||
|
|
"preserve_code": true,
|
||
|
|
"language_hint": "eng"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
"""
|
||
|
|
|
||
|
|
let config = try extractionConfigFromJson(configJson)
|
||
|
|
let result = try extractFileSync("document.pdf", nil, config)
|
||
|
|
|
||
|
|
print("Reduced content length: \(result.content().toString().count)")
|
||
|
|
```
|