porter-stemmer 0.1.2

Flexible and unicode friendly, Porter stemmer implementation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern crate unicode_segmentation;
extern crate porter_stemmer;

use unicode_segmentation::UnicodeSegmentation;
use porter_stemmer::stem;

fn main() {

    let original = "Almost  forty  years  later,  these  fair information  practices  have  become  the standard  for  privacy  protection  around  the  world.  And  yet,  over  that same time  period,  we  have  seen  an  exponential  growth  in  the  use  of surveillance technologies,  and  our  daily  interactions  are  now  routinely  captured, recorded, and manipulated by small and large institutions alike.";

    let tokenised_sentence = original.clone().unicode_words();

    println!("Original:\n{}", original);
    println!("Stemmed:\n{}", tokenised_sentence.map(stem).fold(String::new(), |last, next| { format!("{}{} ", last, next)}));

}