Crates.io | flashtext |
lib.rs | flashtext |
version | 0.1.0 |
source | src |
created_at | 2020-04-06 18:29:48.289474 |
updated_at | 2020-04-06 18:29:48.289474 |
description | Rust implementation of flashtext algorithm to search and replace keywords in given text |
homepage | |
repository | |
max_upload_size | |
id | 227025 |
size | 19,939 |
Rust implementation of flashtext algorithm to search and replace keywords in given text
Add this to your Cargo.toml
[dependencies]
flashtext = "0.1.0"
use flashtext::KeywordProcessor;
let mut keywordprocessor = KeywordProcessor::new(false);
keywordprocessor.add_keyword("apple");
println!("{:?}", keywordprocessor.find_keywords("An apple fell from the tree");
use flashtext::KeywordProcessor;
let mut keywordprocessor = KeywordProcessor::new(false);
keywordprocessor.add_keywords("dancing", "reading");
println!("{}", keywordprocessor.replace_keywords("She likes dancing"));
This experimental implementation is for learning purposes. For better performance and more features you should use rust's regex engine.