This commit is contained in:
27
docs/snippets/swift/config/chunking_config.md
Normal file
27
docs/snippets/swift/config/chunking_config.md
Normal file
@@ -0,0 +1,27 @@
|
||||
```swift title="Swift"
|
||||
import Foundation
|
||||
import Kreuzberg
|
||||
import RustBridge
|
||||
|
||||
let configJson = """
|
||||
{
|
||||
"chunking": {
|
||||
"max_characters": 1000,
|
||||
"overlap": 100,
|
||||
"chunker_type": "markdown",
|
||||
"prepend_heading_context": true
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
let config = try extractionConfigFromJson(configJson)
|
||||
let result = try extractFileSync("document.md", nil, config)
|
||||
|
||||
if let chunks = result.chunks() {
|
||||
print("Chunks: \(chunks.count)")
|
||||
for chunk in chunks {
|
||||
let content = chunk.content().toString()
|
||||
print("Length: \(content.count)")
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user