mirror of
https://github.com/instant-labs/instant-segment.git
synced 2025-01-31 13:12:12 +00:00
Simplify loop
This commit is contained in:
parent
c21b66ab83
commit
bba1de7543
@ -73,7 +73,7 @@ impl Segmenter {
|
||||
pub fn score_sentence<'a>(&self, mut words: impl Iterator<Item = &'a str>) -> Option<f64> {
|
||||
let mut prev = words.next()?;
|
||||
let mut score = self.score(prev, None);
|
||||
while let Some(word) = words.next() {
|
||||
for word in words {
|
||||
score += self.score(word, Some(prev));
|
||||
prev = word;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user