From 054adb14499872d9829ff0041b014fe2f50a5a93 Mon Sep 17 00:00:00 2001 From: Sander Hautvast Date: Wed, 11 May 2022 22:09:56 +0200 Subject: [PATCH] bugfix --- src/lm/mle.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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!["", "", ""]); }