This commit is contained in:
21
docs/snippets/swift/advanced/token_reduction_config.md
Normal file
21
docs/snippets/swift/advanced/token_reduction_config.md
Normal file
@@ -0,0 +1,21 @@
|
||||
```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)")
|
||||
```
|
||||
Reference in New Issue
Block a user