layered-nlp 0.1.1

Highly-flexible data-oriented NLP framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use super::{LLCursorAssignment, LLSelection};

pub trait FinishWith<T> {
    fn finish_with<Attr, F: Fn(T) -> Attr>(self, f: F) -> Vec<LLCursorAssignment<Attr>>;
}

impl<T, I: IntoIterator<Item = (LLSelection, T)>> FinishWith<T> for I {
    fn finish_with<Attr, F: Fn(T) -> Attr>(self, f: F) -> Vec<LLCursorAssignment<Attr>> {
        self.into_iter()
            .map(|(selection, t)| selection.finish_with_attr(f(t)))
            .collect()
    }
}