mapwords

Crates.iomapwords
lib.rsmapwords
version0.1.5
sourcesrc
created_at2023-03-23 10:29:12.865559
updated_at2023-03-24 00:11:14.425235
descriptionHashMap based keyword extraction
homepagehttps://github.com/jjoeldaniel/mapwords.rs
repositoryhttps://github.com/jjoeldaniel/mapwords.rs
max_upload_size
id818194
size14,810
Joel (jjoeldaniel)

documentation

README

mapwords.rs

https://github.com/jjoeldaniel/mapwords.rs/actions/workflows/ci.yml

mapwords.rs is a Rust library that provides functionality for collecting keywords from a given string or file and then sorts and prints them based on their frequency. It ignores stop words and only returns the most frequently occurring keywords.

Installation

To use mapwords.rs in your Rust project, add the following line to your Cargo.toml file:

[dependencies]
mapwords = "0.1.5"

Usage

First, import the MapWordsString or MapWordsFile struct from the mapwords crate:

use mapwords::MapWordsString;
use mapwords::MapWordsFile;

Then, create a new instance of either struct by calling the new function with either a string or file path and a number representing the number of top keywords to return:

let mut map_words = MapWordsString::new("This is a test string".to_string(), 2);

You can then get the keywords by calling the get_keywords() function. This returns a Vec<(&u16, &String)> if you would like to print it out yourself

let keywords = map_words.get_keywords();

Finally, you can print the top keywords by calling the print_keywords() function:

map_words.print_keywords();

License

mapwords.rs is licensed under the WTFPL License. See the LICENSE file for more details.

Commit count: 52

cargo fmt