Crate rake

source ·
Expand description

§RAKE.rs

The library provides a multilingual implementation of Rapid Automatic Keyword Extraction (RAKE) algorithm for Rust.

§How to Use

  • Add rake to the dependencies of your project’s Cargo.toml:
[dependencies]
rake = "0.1"

If you’re using Rust 2015, then you’ll also need to add it to your crate root:

extern crate rake;

§Example

// Import modules
use rake::*;

// Create a new instance of `Rake` struct
let text = "a long text";
let stop_words_list_path = "tests/SmartStoplist.txt";
let sw = StopWords::from_file(stop_words_list_path).unwrap();
let r = Rake::new(sw);
let keywords = r.run(text);

// Iterate over keywords
keywords.iter().for_each(
    |&KeywordScore {
        ref keyword,
        ref score,
    }| println!("{}: {}", keyword, score),
);

Structs§

Traits§

  • An interface to sort a vector of keywords by score