Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vbkaisetsu committed May 30, 2022
1 parent 3294d41 commit c8f7a4c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions vaporetto/src/type_scorer/boundary_scorer_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ impl TypeScorerBoundaryCache {
.map_err(|_| VaporettoError::invalid_model("invalid character type n-grams"))?;
let mut weights = vec![];
for d in model.0 {
if d.weights.len() <= 2 * usize::from(window_size) - d.ngram.len() {
return Err(VaporettoError::invalid_model(
"invalid size of weight vector",
));
}
weights.push(d.weights);
}

Expand All @@ -44,7 +39,9 @@ impl TypeScorerBoundaryCache {
}
let mut y = 0;
for m in pma.find_overlapping_iter(&sequence) {
y += weights[m.value()][usize::from(sequence_size) - m.end()];
if let Some(w) = weights[m.value()].get(usize::from(sequence_size) - m.end()) {
y += *w;
}
}
*score = y;
}
Expand Down

0 comments on commit c8f7a4c

Please sign in to comment.