Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix(core): return item count

Elijah Potter4c17c2d38466
diff --git a/harper-core/dictionary.dict b/harper-core/dictionary.dict
index da168b5af..3c1ea5838 100644
--- a/harper-core/dictionary.dict
+++ b/harper-core/dictionary.dict
@@ -1,3 +1,4 @@
+50350
AA/1254M
AAA/12
AB/215M
@@ -50328,4 +50329,3 @@ gzipping/4
Reddit/2M
Xbox/12MS
eggcorn/1
-/~
diff --git a/harper-core/src/spell/mod.rs b/harper-core/src/spell/mod.rs
index 9721a90b8..6ea5d784d 100644
--- a/harper-core/src/spell/mod.rs
+++ b/harper-core/src/spell/mod.rs
@@ -30,7 +30,7 @@ impl PartialOrd for FuzzyMatchResult<'_> {
///
/// Lower = better.
fn score_suggestion(misspelled_word: &[char], sug: &FuzzyMatchResult) -> i32 {
- if misspelled_word.is_empty() {
+ if misspelled_word.is_empty() || sug.word.is_empty() {
return i32::MAX;
}
@@ -118,9 +118,7 @@ fn char_to_normalized(c: char) -> char {
mod tests {
use itertools::Itertools;
- use super::{
- FstDictionary, order_suggestions, seq_to_normalized, suggest_correct_spelling_str,
- };
+ use super::{FstDictionary, seq_to_normalized, suggest_correct_spelling_str};
const RESULT_LIMIT: usize = 100;
const MAX_EDIT_DIST: u8 = 2;