Skip to content

Commit d17f366

Browse files
committed
Simplify ngram conditionals
1 parent cbe999d commit d17f366

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

bin/generator-utils/ngram

0 Bytes
Binary file not shown.

util/ngram/src/main.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,12 @@ fn main() {
1414
}
1515

1616
if let Some(top_result) = corpus.search(&slug, 0.25).first() {
17-
if top_result.similarity > 0.99 {
18-
println!("{}", top_result.text);
19-
} else {
20-
println!(
21-
"{} - There is an exercise with a similar name: '{}' [{:.0}% match]",
22-
slug,
23-
top_result.text,
24-
top_result.similarity * 100.0
25-
);
26-
}
17+
println!(
18+
"{} - There is an exercise with a similar name: '{}' [{:.0}% match]",
19+
slug,
20+
top_result.text,
21+
top_result.similarity * 100.0
22+
);
2723
} else {
2824
println!("Couldn't find any exercise similar to this: {}", slug);
2925
}

0 commit comments

Comments
 (0)