From 5afabf72f99459511438b22147fc6df29f4a232a Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 5 Nov 2024 15:42:42 -0600 Subject: [PATCH] fix(dict): Prefer correcting alingment to alignment Fixes #1143 --- crates/typos-dict/assets/words.csv | 4 ++-- crates/typos-dict/src/word_codegen.rs | 4 ++-- crates/typos-dict/tests/verify.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/typos-dict/assets/words.csv b/crates/typos-dict/assets/words.csv index a8dcbf6..e41eeff 100644 --- a/crates/typos-dict/assets/words.csv +++ b/crates/typos-dict/assets/words.csv @@ -2452,8 +2452,8 @@ alimunium,aluminium aling,aline,along,ailing,sling alinged,alined alinging,aligning -alingment,alinement -alingments,alinements +alingment,alignment +alingments,alignments alings,alines,slings alinment,alignment alinments,alignments diff --git a/crates/typos-dict/src/word_codegen.rs b/crates/typos-dict/src/word_codegen.rs index 4b9b88a..42dee1d 100644 --- a/crates/typos-dict/src/word_codegen.rs +++ b/crates/typos-dict/src/word_codegen.rs @@ -225440,8 +225440,8 @@ pub static WORD_ALI_CHILDREN: dictgen::DictTable<&'static [&'static str]> = dict &["aline", "along", "ailing", "sling"], &["alined"], &["aligning"], - &["alinement"], - &["alinements"], + &["alignment"], + &["alignments"], &["alines", "slings"], &["alignment"], &["alignments"], diff --git a/crates/typos-dict/tests/verify.rs b/crates/typos-dict/tests/verify.rs index 7afa2a4..2bc2131 100644 --- a/crates/typos-dict/tests/verify.rs +++ b/crates/typos-dict/tests/verify.rs @@ -227,7 +227,7 @@ fn find_best_match<'c>( #[allow(clippy::single_match)] match (typo, correction) { // Picking the worst option due to a letter swap being an edit distance of two - ("alinging", "aligning") => { + ("alinging", "aligning") | ("alingment", "alignment") | ("alingments", "alignments") => { return None; } _ => {}