Simplify loop

This commit is contained in:
Dirkjan Ochtman 2021-04-22 15:07:54 +02:00
parent c21b66ab83
commit bba1de7543
1 changed files with 1 additions and 1 deletions

View File

@ -73,7 +73,7 @@ impl Segmenter {
pub fn score_sentence<'a>(&self, mut words: impl Iterator<Item = &'a str>) -> Option<f64> { pub fn score_sentence<'a>(&self, mut words: impl Iterator<Item = &'a str>) -> Option<f64> {
let mut prev = words.next()?; let mut prev = words.next()?;
let mut score = self.score(prev, None); let mut score = self.score(prev, None);
while let Some(word) = words.next() { for word in words {
score += self.score(word, Some(prev)); score += self.score(word, Some(prev));
prev = word; prev = word;
} }