This commit is contained in:
23
docs/snippets/rust/config/keyword_extraction_config.md
Normal file
23
docs/snippets/rust/config/keyword_extraction_config.md
Normal file
@@ -0,0 +1,23 @@
|
||||
```rust title="Rust"
|
||||
use kreuzberg::{extract_file, ExtractionConfig};
|
||||
use kreuzberg::keywords::{KeywordConfig, KeywordAlgorithm};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> kreuzberg::Result<()> {
|
||||
let config = ExtractionConfig {
|
||||
keywords: Some(KeywordConfig {
|
||||
algorithm: KeywordAlgorithm::Yake,
|
||||
max_keywords: 10,
|
||||
min_score: 0.1,
|
||||
ngram_range: (1, 3),
|
||||
language: Some("en".to_string()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let result = extract_file("document.pdf", None::<&str>, &config).await?;
|
||||
println!("Keywords: {:?}", result.keywords);
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user