diff --git a/src/lm/mle.rs b/src/lm/mle.rs index b22b805..9b248d1 100644 --- a/src/lm/mle.rs +++ b/src/lm/mle.rs @@ -31,8 +31,8 @@ impl <'a>Vocabulary<'a> { }; } - pub(crate) fn lookup_sentence(&self, words: impl Iterator + 'a) -> impl Iterator + '_{ - words.map(|word| if self.counter.get(word) > self.cutoff { + pub(crate) fn lookup_sentence(&self, sentence: impl Iterator + 'a) -> impl Iterator + '_{ + sentence.map(|word| if self.counter.get(word) > self.cutoff { word } else { self.unk_label @@ -83,7 +83,7 @@ mod tests { fn test_lookup_below_cutoff() { let mut vocab = Vocabulary::new(1); vocab.update_sentence(["a", "b", "c"].iter()); - let looked_up: Vec<&str> = vocab.lookup_words(["a", "b", "c"].iter()).collect(); + let looked_up: Vec<&str> = vocab.lookup_sentence(["a", "b", "c"].iter()).collect(); assert_eq!(looked_up, vec!["", "", ""]); }