Expose Keywords::{clone,len,is_empty}()
- Id
- f8b8850940c6d202abda8b9ca556d68722843cff
- Author
- Caio
- Commit time
- 2020-02-19T19:21:17+01:00
Modified tique/src/topterms.rs
}
/// Keywords is a collection of Term objects found via TopTerms
+#[derive(Clone)]
pub struct Keywords(Vec<(Term, f32)>);
impl Keywords {
/// terms appear first
pub fn terms(&self) -> impl Iterator<Item = &Term> {
self.0.iter().map(|(term, _score)| term)
+ }
+
+ /// How many terms this set contains
+ pub fn len(&self) -> usize {
+ self.0.len()
+ }
+
+ pub fn is_empty(&self) -> bool {
+ self.0.is_empty()
}
/// Exposes the ordered terms and their scores. Useful if you are