This commit is contained in:
29
docs/snippets/go/utils/keyword_extraction_example.md
Normal file
29
docs/snippets/go/utils/keyword_extraction_example.md
Normal file
@@ -0,0 +1,29 @@
|
||||
```go title="Go"
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/kreuzberg-dev/kreuzberg/packages/go/v5"
|
||||
)
|
||||
|
||||
func main() {
|
||||
config := &kreuzberg.ExtractionConfig{
|
||||
Keywords: &kreuzberg.KeywordConfig{
|
||||
Algorithm: "YAKE",
|
||||
MaxKeywords: 10,
|
||||
MinScore: 0.3,
|
||||
},
|
||||
}
|
||||
|
||||
result, err := kreuzberg.ExtractFileSync("research_paper.pdf", config)
|
||||
if err != nil {
|
||||
log.Fatalf("extract failed: %v", err)
|
||||
}
|
||||
|
||||
if keywords, ok := result.Metadata.Additional["keywords"]; ok {
|
||||
fmt.Printf("Keywords: %v\n", keywords)
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user