#message #keyword #utils

ssage

Library to extract important words from a sequence of messages or a full text

1 unstable release

0.1.0-alpha1 Sep 17, 2022

#467 in #message

MIT license

11KB
210 lines

Ssage


Extract important words from a sequence of messages or a full text and give it singular priority.

Sample of use

Supposing a sentence like "hi! this is just a sample message with distinct words." we could extract keywords and prioritize it.

use ssage::Ssage;

fn sample() {
    let mut ssage = Ssage::new(Default::default());

    let _ = ssage.feed("hi! this is just a sample message with distinct words.");
    ssage.prioritize_keyword("message");
    ssage.prioritize_keyword("just");
    ssage.prioritize_keyword("just");
    ssage.prioritize_keyword("message");
    ssage.prioritize_keyword("message");
    ssage.prioritize_keyword("just");
    ssage.prioritize_keyword("message");

    println!("Output: {}", ssage.feed("just a message"));
}

This should output message just since we prioritize more message than just and as the default configuration excluded words that are less than 4 characters.

Dependencies

~1.5MB
~28K SLoC