use string_cache::DefaultAtom;
fn main() {
let mut interned_stuff = Vec::new();
let text = "here is a sentence of text that will be tokenised and interned and some repeated \
tokens is of text and";
for word in text.split_whitespace() {
let seen_before = interned_stuff
.iter()
.filter(|interned_word| interned_word == &word)
.count();
if seen_before > 0 {
println!(r#"Seen the word "{}" {} times"#, word, seen_before);
} else {
println!(r#"Not seen the word "{}" before"#, word);
}
interned_stuff.push(DefaultAtom::from(word));
}
}