Nomad changes
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s

This commit is contained in:
Henrik Jess Nielsen
2026-06-01 23:40:55 +02:00
parent 72b1a0a6ed
commit b4c07d3693
5723 changed files with 1130655 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
```swift title="Swift"
import Kreuzberg
final class WordCountProcessor: PostProcessor {
func name() -> String {
"word_count"
}
func version() -> String {
"1.0.0"
}
func processingStage() -> String {
"early"
}
func priority() -> Int32 {
50
}
func process(result: ExtractionResult, config: ExtractionConfig) -> String {
let content = result.content()
let words = content.split(separator: " ").count
// Metadata is not directly mutable via the FFI, so store in logs or use
// a side-channel approach. For now, just track that processing happened.
return "{\"ok\": null}"
}
func shouldProcess(result: ExtractionResult, config: ExtractionConfig) -> Bool {
!result.content().isEmpty
}
func estimatedDurationMs(result: ExtractionResult) -> UInt64 {
5
}
func initialize() -> String {
"{\"ok\": null}"
}
func shutdown() -> String {
"{\"ok\": null}"
}
}
let processor = WordCountProcessor()
try Kreuzberg.registerPostProcessor(processor)
```