Skip to content

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

fix: ensure grey is suggested when gray is wrong (#1403)

Andrew Dunbar2d2a5e4eaff1
diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rs
index d35e442b5..0f38ccb36 100644
--- a/harper-core/src/linting/mod.rs
+++ b/harper-core/src/linting/mod.rs
@@ -208,7 +208,7 @@ where
}
#[cfg(test)]
-mod tests {
+pub mod tests {
use super::Linter;
use crate::{Document, FstDictionary, parsers::PlainEnglish};
diff --git a/harper-core/src/linting/spell_check.rs b/harper-core/src/linting/spell_check.rs
index dfaa63478..3625f4086 100644
--- a/harper-core/src/linting/spell_check.rs
+++ b/harper-core/src/linting/spell_check.rs
@@ -6,10 +6,7 @@ use smallvec::ToSmallVec;
use super::Suggestion;
use super::{Lint, LintKind, Linter};
use crate::document::Document;
-use crate::spell::{
- is_cksz_misspelling, is_er_misspelling, is_ll_misspelling, is_ou_misspelling,
- suggest_correct_spelling,
-};
+use crate::spell::suggest_correct_spelling;
use crate::{CharString, CharStringExt, Dialect, Dictionary, TokenStringExt};
pub struct SpellCheck<T>
@@ -86,16 +83,6 @@ impl<T: Dictionary> Linter for SpellCheck<T> {
};
let mut possibilities = self.suggest_correct_spelling(word_chars);
- if let Some(most_likely) = possibilities.first() {
- // If the most likely suggestion is a common misspelling, ignore all others.
- if is_ou_misspelling(most_likely, word_chars)
- || is_cksz_misspelling(most_likely, word_chars)
- || is_er_misspelling(most_likely, word_chars)
- || is_ll_misspelling(most_likely, word_chars)
- {
- possibilities.truncate(1);
- }
- }
// If the misspelled word is capitalized, capitalize the results too.
if let Some(mis_f) = word_chars.first() {
diff --git a/harper-core/src/spell/mod.rs b/harper-core/src/spell/mod.rs
index 09d1d7412..b775210dd 100644
--- a/harper-core/src/spell/mod.rs
+++ b/harper-core/src/spell/mod.rs
@@ -183,6 +183,48 @@ pub(crate) fn is_ll_misspelling(a: &[char], b: &[char]) -> bool {
}
}
+/// Returns whether the two words are the same, except that one is written
+/// with 'ay' and the other with 'ey'.
+///
+/// E.g. "gray" and "grey"
+pub(crate) fn is_ay_ey_misspelling(a: &[char], b: &[char]) -> bool {
+ if a.len() != b.len() {
+ return false;
+ }
+
+ let mut found_ay_ey = false;
+ let mut a_iter = a.iter();
+ let mut b_iter = b.iter();
+
+ while let (Some(&a_char), Some(&b_char)) = (a_iter.next(), b_iter.next()) {
+ if a_char.eq_ignore_ascii_case(&b_char) {
+ continue;
+ }
+
+ // Check for 'a'/'e' difference
+ if (a_char.eq_ignore_ascii_case(&'a') && b_char.eq_ignore_ascii_case(&'e'))
+ || (a_char.eq_ignore_ascii_case(&'e') && b_char.eq_ignore_ascii_case(&'a'))
+ {
+ // Check if next character is 'y' for both
+ if let (Some(&a_next), Some(&b_next)) = (a_iter.next(), b_iter.next()) {
+ if a_next.eq_ignore_ascii_case(&'y') && b_next.eq_ignore_ascii_case(&'y') {
+ if found_ay_ey {
+ return false; // More than one ay/ey difference
+ }
+ found_ay_ey = true;
+ continue;
+ }
+ }
+ }
+ return false; // Non-ay/ey difference found
+ }
+
+ if !found_ay_ey {
+ return false;
+ }
+ found_ay_ey
+}
+
/// Scores a possible spelling suggestion based on possible relevance to the user.
///
/// Lower = better.
@@ -221,9 +263,10 @@ fn score_suggestion(misspelled_word: &[char], sug: &FuzzyMatchResult) -> i32 {
if sug.edit_distance == 1
&& (is_cksz_misspelling(misspelled_word, sug.word)
|| is_ou_misspelling(misspelled_word, sug.word)
- || is_ll_misspelling(misspelled_word, sug.word))
+ || is_ll_misspelling(misspelled_word, sug.word)
+ || is_ay_ey_misspelling(misspelled_word, sug.word))
{
- score -= 5;
+ score -= 6;
}
if sug.edit_distance == 2 && is_er_misspelling(misspelled_word, sug.word) {
score -= 15;
@@ -277,7 +320,10 @@ pub fn suggest_correct_spelling_str(
mod tests {
use itertools::Itertools;
- use crate::CharStringExt;
+ use crate::{
+ CharStringExt, Dialect,
+ linting::{SpellCheck, tests::assert_suggestion_result},
+ };
use super::{FstDictionary, suggest_correct_spelling_str};
@@ -432,4 +478,22 @@ mod tests {
fn conciousness_correction() {
assert_suggests_correction("conciousness", "consciousness");
}
+
+ #[test]
+ fn suggest_grey_for_gray_in_non_american() {
+ assert_suggestion_result(
+ "I've got a gray cat.",
+ SpellCheck::new(FstDictionary::curated(), Dialect::British),
+ "I've got a grey cat.",
+ );
+ }
+
+ #[test]
+ fn suggest_gray_for_grey_in_american() {
+ assert_suggestion_result(
+ "It's a greyscale photo.",
+ SpellCheck::new(FstDictionary::curated(), Dialect::American),
+ "It's a grayscale photo.",
+ );
+ }
}
diff --git a/harper-core/tests/text/linters/Alice's Adventures in Wonderland.snap.yml b/harper-core/tests/text/linters/Alice's Adventures in Wonderland.snap.yml
index a614a510f..ee78514c2 100644
--- a/harper-core/tests/text/linters/Alice's Adventures in Wonderland.snap.yml
+++ b/harper-core/tests/text/linters/Alice's Adventures in Wonderland.snap.yml
@@ -88,9 +88,11 @@ Message: |
Lint: Spelling (63 priority)
Message: |
43 | shelves as she passed; it was labelled “ORANGE MARMALADE”, but to her great
- | ^~~~~~~~ Did you mean `labeled`?
+ | ^~~~~~~~ Did you mean to spell `labelled` this way?
Suggest:
- Replace with: “labeled”
+ - Replace with: “labeler”
+ - Replace with: “labelless”
@@ -98,9 +100,11 @@ Lint: Spelling (63 priority)
Message: |
54 | I’ve fallen by this time?” she said aloud. “I must be getting somewhere near the
55 | centre of the earth. Let me see: that would be four thousand miles down, I
- | ^~~~~~ Did you mean `center`?
+ | ^~~~~~ Did you mean to spell `centre` this way?
Suggest:
- Replace with: “center”
+ - Replace with: “censure”
+ - Replace with: “cent”
@@ -318,10 +322,12 @@ Message: |
Lint: Spelling (63 priority)
Message: |
138 | finding it very nice, (it had, in fact, a sort of mixed flavour of cherry-tart,
- | ^~~~~~~ Did you mean `flavor`?
+ | ^~~~~~~ Did you mean to spell `flavour` this way?
139 | custard, pine-apple, roast turkey, toffee, and hot buttered toast,) she very
Suggest:
- Replace with: “flavor”
+ - Replace with: “favor”
+ - Replace with: “flour”
@@ -502,9 +508,11 @@ Lint: Spelling (63 priority)
Message: |
229 | “If you please, sir—” The Rabbit started violently, dropped the white kid gloves
230 | and the fan, and skurried away into the darkness as hard as he could go.
- | ^~~~~~~~ Did you mean `scurried`?
+ | ^~~~~~~~ Did you mean to spell `skurried` this way?
Suggest:
- Replace with: “scurried”
+ - Replace with: “spurred”
+ - Replace with: “scurries”
@@ -795,9 +803,11 @@ Lint: Spelling (63 priority)
Message: |
387 | driest thing I know. Silence all round, if you please! ‘William the Conqueror,
388 | whose cause was favoured by the pope, was soon submitted to by the English, who
- | ^~~~~~~~ Did you mean `favored`?
+ | ^~~~~~~~ Did you mean to spell `favoured` this way?
Suggest:
- Replace with: “favored”
+ - Replace with: “flavored”
+ - Replace with: “floured”
@@ -1067,18 +1077,22 @@ Lint: Spelling (63 priority)
Message: |
660 | voice she had never heard before, “Sure then I’m here! Digging for apples, yer
661 | honour!”
- | ^~~~~~ Did you mean `honor`?
+ | ^~~~~~ Did you mean to spell `honour` this way?
Suggest:
- Replace with: “honor”
+ - Replace with: “hour”
+ - Replace with: “honer”
Lint: Spelling (63 priority)
Message: |
668 | “Sure, it’s an arm, yer honour!” (He pronounced it “arrum.”)
- | ^~~~~~ Did you mean `honor`?
+ | ^~~~~~ Did you mean to spell `honour` this way?
Suggest:
- Replace with: “honor”
+ - Replace with: “hour”
+ - Replace with: “honer”
@@ -1096,18 +1110,22 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
672 | “Sure, it does, yer honour: but it’s an arm for all that.”
- | ^~~~~~ Did you mean `honor`?
+ | ^~~~~~ Did you mean to spell `honour` this way?
Suggest:
- Replace with: “honor”
+ - Replace with: “hour”
+ - Replace with: “honer”
Lint: Spelling (63 priority)
Message: |
677 | then; such as, “Sure, I don’t like it, yer honour, at all, at all!” “Do as I
- | ^~~~~~ Did you mean `honor`?
+ | ^~~~~~ Did you mean to spell `honour` this way?
Suggest:
- Replace with: “honor”
+ - Replace with: “hour”
+ - Replace with: “honer”
@@ -1703,10 +1721,11 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
1497 | The Hatter shook his head mournfully. “Not I!” he replied. “We quarrelled last
- | ^~~~~~~~~~ Did you mean `quarreled`?
+ | ^~~~~~~~~~ Did you mean to spell `quarrelled` this way?
1498 | March—just before he went mad, you know—” (pointing with his tea spoon at the
Suggest:
- Replace with: “quarreled”
+ - Replace with: “quarreler”
@@ -1840,9 +1859,11 @@ Lint: Spelling (63 priority)
Message: |
1713 | they were all ornamented with hearts. Next came the guests, mostly Kings and
1714 | Queens, and among them Alice recognised the White Rabbit: it was talking in a
- | ^~~~~~~~~~ Did you mean `recognized`?
+ | ^~~~~~~~~~ Did you mean to spell `recognised` this way?
Suggest:
- Replace with: “recognized”
+ - Replace with: “recognize”
+ - Replace with: “recognizer”
@@ -2144,9 +2165,9 @@ Message: |
1985 | “’Tis so,” said the Duchess: “and the moral of that is—‘Oh, ’tis love, ’tis
| ^~~ Did you mean to spell `Tis` this way?
Suggest:
+ - Replace with: “Tic”
- Replace with: “T's”
- Replace with: “This”
- - Replace with: “Ti's”
@@ -2156,9 +2177,9 @@ Message: |
| ^~~ Did you mean to spell `tis` this way?
1986 | love, that makes the world go round!’”
Suggest:
+ - Replace with: “tic”
- Replace with: “this”
- Replace with: “ti's”
- - Replace with: “tic”
@@ -2168,9 +2189,9 @@ Message: |
| ^~~ Did you mean to spell `tis` this way?
1986 | love, that makes the world go round!’”
Suggest:
+ - Replace with: “tic”
- Replace with: “this”
- Replace with: “ti's”
- - Replace with: “tic”
@@ -2214,9 +2235,10 @@ Lint: Spelling (63 priority)
Message: |
2048 | But here, to Alice’s great surprise, the Duchess’s voice died away, even in the
2049 | middle of her favourite word ‘moral,’ and the arm that was linked into hers
- | ^~~~~~~~~ Did you mean `favorite`?
+ | ^~~~~~~~~ Did you mean to spell `favourite` this way?
Suggest:
- Replace with: “favorite”
+ - Replace with: “favorites”
@@ -2844,9 +2866,9 @@ Message: |
2418 | “Stand up and repeat ‘’Tis the voice of the sluggard,’” said the Gryphon.
| ^~~ Did you mean to spell `Tis` this way?
Suggest:
+ - Replace with: “Tic”
- Replace with: “T's”
- Replace with: “This”
- - Replace with: “Ti's”
@@ -2864,9 +2886,9 @@ Message: |
2425 | > “’Tis the voice of the Lobster; I heard him declare, “You have baked me too
| ^~~ Did you mean to spell `Tis` this way?
Suggest:
+ - Replace with: “Tic”
- Replace with: “T's”
- Replace with: “This”
- - Replace with: “Ti's”
@@ -3285,9 +3307,10 @@ Lint: Spelling (63 priority)
Message: |
2547 | even make out that one of them didn’t know how to spell “stupid,” and that he
2548 | had to ask his neighbour to tell him. “A nice muddle their slates’ll be in
- | ^~~~~~~~~ Did you mean `neighbor`?
+ | ^~~~~~~~~ Did you mean to spell `neighbour` this way?
Suggest:
- Replace with: “neighbor”
+ - Replace with: “neighbors”
@@ -3628,10 +3651,12 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
2988 | noises, would change (she knew) to the confused clamour of the busy
- | ^~~~~~~ Did you mean `clamor`?
+ | ^~~~~~~ Did you mean to spell `clamour` this way?
2989 | farm-yard—while the lowing of the cattle in the distance would take the place of
Suggest:
- Replace with: “clamor”
+ - Replace with: “glamour”
+ - Replace with: “clamber”
diff --git a/harper-core/tests/text/linters/Difficult sentences.snap.yml b/harper-core/tests/text/linters/Difficult sentences.snap.yml
index 2d286a1fe..b205094a6 100644
--- a/harper-core/tests/text/linters/Difficult sentences.snap.yml
+++ b/harper-core/tests/text/linters/Difficult sentences.snap.yml
@@ -28,9 +28,11 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
56 | He was protected by his body armour.
- | ^~~~~~ Did you mean `armor`?
+ | ^~~~~~ Did you mean to spell `armour` this way?
Suggest:
- Replace with: “armor”
+ - Replace with: “amour”
+ - Replace with: “arbor”
@@ -86,9 +88,11 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
208 | My aim in travelling there was to find my missing friend.
- | ^~~~~~~~~~ Did you mean `traveling`?
+ | ^~~~~~~~~~ Did you mean to spell `travelling` this way?
Suggest:
- Replace with: “traveling”
+ - Replace with: “travailing”
+ - Replace with: “travelings”
@@ -136,18 +140,22 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
258 | I need to keep in with the neighbours in case I ever need a favour from them.
- | ^~~~~~~~~~ Did you mean `neighbors`?
+ | ^~~~~~~~~~ Did you mean to spell `neighbours` this way?
Suggest:
- Replace with: “neighbors”
+ - Replace with: “neighbor's”
+ - Replace with: “neighbor”
Lint: Spelling (63 priority)
Message: |
258 | I need to keep in with the neighbours in case I ever need a favour from them.
- | ^~~~~~ Did you mean `favor`?
+ | ^~~~~~ Did you mean to spell `favour` this way?
Suggest:
- Replace with: “favor”
+ - Replace with: “famous”
+ - Replace with: “flavor”
@@ -164,9 +172,10 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
284 | This behaviour is typical of teenagers.
- | ^~~~~~~~~ Did you mean `behavior`?
+ | ^~~~~~~~~ Did you mean to spell `behaviour` this way?
Suggest:
- Replace with: “behavior”
+ - Replace with: “behaviors”
@@ -288,18 +297,22 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
366 | He travelled on false documents.
- | ^~~~~~~~~ Did you mean `traveled`?
+ | ^~~~~~~~~ Did you mean to spell `travelled` this way?
Suggest:
- Replace with: “traveled”
+ - Replace with: “traveler”
+ - Replace with: “travailed”
Lint: Spelling (63 priority)
Message: |
398 | Who am I to criticise? I've done worse things myself.
- | ^~~~~~~~~ Did you mean `criticize`?
+ | ^~~~~~~~~ Did you mean to spell `criticise` this way?
Suggest:
- Replace with: “criticize”
+ - Replace with: “criticism”
+ - Replace with: “critic's”
diff --git a/harper-core/tests/text/linters/Part-of-speech tagging.snap.yml b/harper-core/tests/text/linters/Part-of-speech tagging.snap.yml
index f01fb81c8..4e714628b 100644
--- a/harper-core/tests/text/linters/Part-of-speech tagging.snap.yml
+++ b/harper-core/tests/text/linters/Part-of-speech tagging.snap.yml
@@ -434,8 +434,8 @@ Message: |
| ^~~~~~~~ Did you mean to spell `analyses` this way?
167 | probabilities, and other related data, and replicated his work for Greek, where
Suggest:
- - Replace with: “analysis”
- Replace with: “analyzes”
+ - Replace with: “analysis”
- Replace with: “analysts”
@@ -494,10 +494,12 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
201 | algorithm, Brill tagger, Constraint Grammar, and the Baum-Welch algorithm (also
- | ^~~~~ Did you mean `Welsh`?
+ | ^~~~~ Did you mean to spell `Welch` this way?
202 | known as the forward-backward algorithm). Hidden Markov model and visible Markov
Suggest:
- Replace with: “Welsh”
+ - Replace with: “Belch”
+ - Replace with: “Walsh”
diff --git a/harper-core/tests/text/linters/Spell.snap.yml b/harper-core/tests/text/linters/Spell.snap.yml
index c5eba8a80..4007e125c 100644
--- a/harper-core/tests/text/linters/Spell.snap.yml
+++ b/harper-core/tests/text/linters/Spell.snap.yml
@@ -1,9 +1,10 @@
Lint: Spelling (63 priority)
Message: |
7 | My favourite color is blu.
- | ^~~~~~~~~ Did you mean `favorite`?
+ | ^~~~~~~~~ Did you mean to spell `favourite` this way?
Suggest:
- Replace with: “favorite”
+ - Replace with: “favorites”
@@ -21,72 +22,88 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
8 | I must defend my honour!
- | ^~~~~~ Did you mean `honor`?
+ | ^~~~~~ Did you mean to spell `honour` this way?
Suggest:
- Replace with: “honor”
+ - Replace with: “hour”
+ - Replace with: “honer”
Lint: Spelling (63 priority)
Message: |
9 | I recognize that you recognise me.
- | ^~~~~~~~~ Did you mean `recognize`?
+ | ^~~~~~~~~ Did you mean to spell `recognise` this way?
Suggest:
- Replace with: “recognize”
+ - Replace with: “recognized”
+ - Replace with: “recognizer”
Lint: Spelling (63 priority)
Message: |
11 | I analyse how you infantilise me.
- | ^~~~~~~ Did you mean `analyze`?
+ | ^~~~~~~ Did you mean to spell `analyse` this way?
Suggest:
- Replace with: “analyze”
+ - Replace with: “analyst”
+ - Replace with: “analysis”
Lint: Spelling (63 priority)
Message: |
11 | I analyse how you infantilise me.
- | ^~~~~~~~~~~ Did you mean `infantilize`?
+ | ^~~~~~~~~~~ Did you mean to spell `infantilise` this way?
Suggest:
- Replace with: “infantilize”
+ - Replace with: “infantile”
+ - Replace with: “infanticide”
Lint: Spelling (63 priority)
Message: |
12 | Careful, traveller!
- | ^~~~~~~~~ Did you mean `traveler`?
+ | ^~~~~~~~~ Did you mean to spell `traveller` this way?
Suggest:
- Replace with: “traveler”
+ - Replace with: “traveled”
+ - Replace with: “travelers”
Lint: Spelling (63 priority)
Message: |
13 | At the centre of the theatre I dropped a litre of coke.
- | ^~~~~~ Did you mean `center`?
+ | ^~~~~~ Did you mean to spell `centre` this way?
Suggest:
- Replace with: “center”
+ - Replace with: “censure”
+ - Replace with: “cent”
Lint: Spelling (63 priority)
Message: |
13 | At the centre of the theatre I dropped a litre of coke.
- | ^~~~~~~ Did you mean `theater`?
+ | ^~~~~~~ Did you mean to spell `theatre` this way?
Suggest:
- Replace with: “theater”
+ - Replace with: “there”
+ - Replace with: “they're”
Lint: Spelling (63 priority)
Message: |
13 | At the centre of the theatre I dropped a litre of coke.
- | ^~~~~ Did you mean `liter`?
+ | ^~~~~ Did you mean to spell `litre` this way?
Suggest:
- Replace with: “liter”
+ - Replace with: “lire”
+ - Replace with: “lite”
diff --git a/harper-core/tests/text/linters/The Constitution of the United States.snap.yml b/harper-core/tests/text/linters/The Constitution of the United States.snap.yml
index 3be716421..90443b07c 100644
--- a/harper-core/tests/text/linters/The Constitution of the United States.snap.yml
+++ b/harper-core/tests/text/linters/The Constitution of the United States.snap.yml
@@ -16,10 +16,12 @@ Message: |
Lint: Spelling (63 priority)
Message: |
6 | establish Justice, insure domestic Tranquility, provide for the common defence,
- | ^~~~~~~ Did you mean `defense`?
+ | ^~~~~~~ Did you mean to spell `defence` this way?
7 | promote the general Welfare, and secure the Blessings of Liberty to ourselves
Suggest:
- Replace with: “defense”
+ - Replace with: “decency”
+ - Replace with: “deface”
@@ -539,10 +541,12 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
203 | Imposts and Excises, to pay the Debts and provide for the common Defence and
- | ^~~~~~~ Did you mean `Defense`?
+ | ^~~~~~~ Did you mean to spell `Defence` this way?
204 | general Welfare of the United States; but all Duties, Imposts and Excises shall
Suggest:
- Replace with: “Defense”
+ - Replace with: “Fence”
+ - Replace with: “Terence”
@@ -579,9 +583,10 @@ Lint: Spelling (63 priority)
Message: |
229 | 9. To define and punish Piracies and Felonies committed on the high Seas, and
230 | Offences against the Law of Nations;
- | ^~~~~~~~ Did you mean `Offenses`?
+ | ^~~~~~~~ Did you mean to spell `Offences` this way?
Suggest:
- Replace with: “Offenses”
+ - Replace with: “Fences”
@@ -1201,10 +1206,11 @@ Message: |
Lint: Spelling (63 priority)
Message: |
481 | have Power to grant Reprieves and Pardons for Offences against the United
- | ^~~~~~~~ Did you mean `Offenses`?
+ | ^~~~~~~~ Did you mean to spell `Offences` this way?
482 | States, except in Cases of Impeachment.
Suggest:
- Replace with: “Offenses”
+ - Replace with: “Fences”
@@ -1480,9 +1486,11 @@ Lint: Spelling (63 priority)
Message: |
627 | States, or any place subject to their jurisdiction. No Person held to Service
628 | or Labour in one State, under the Laws thereof, escaping into another, shall,
- | ^~~~~~ Did you mean `Labor`?
+ | ^~~~~~ Did you mean to spell `Labour` this way?
Suggest:
- Replace with: “Labor”
+ - Replace with: “About”
+ - Replace with: “Amour”
@@ -1490,9 +1498,11 @@ Lint: Spelling (63 priority)
Message: |
629 | in Consequence of any Law or Regulation therein, be discharged from such
630 | Service or Labour, but shall be delivered up on Claim of the Party to whom such
- | ^~~~~~ Did you mean `Labor`?
+ | ^~~~~~ Did you mean to spell `Labour` this way?
Suggest:
- Replace with: “Labor”
+ - Replace with: “About”
+ - Replace with: “Amour”
@@ -1500,9 +1510,11 @@ Lint: Spelling (63 priority)
Message: |
630 | Service or Labour, but shall be delivered up on Claim of the Party to whom such
631 | Service or Labour may be due.
- | ^~~~~~ Did you mean `Labor`?
+ | ^~~~~~ Did you mean to spell `Labour` this way?
Suggest:
- Replace with: “Labor”
+ - Replace with: “About”
+ - Replace with: “Amour”
@@ -1665,10 +1677,11 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
714 | first Page, The Word "Thirty" being partly written on an Erazure in the
- | ^~~~~~~ Did you mean `Erasure`?
+ | ^~~~~~~ Did you mean to spell `Erazure` this way?
715 | fifteenth Line of the first Page. The Words "is tried" being interlined between
Suggest:
- Replace with: “Erasure”
+ - Replace with: “Azure”
diff --git a/harper-core/tests/text/linters/The Great Gatsby.snap.yml b/harper-core/tests/text/linters/The Great Gatsby.snap.yml
index 925cbb7d2..22d31bf90 100644
--- a/harper-core/tests/text/linters/The Great Gatsby.snap.yml
+++ b/harper-core/tests/text/linters/The Great Gatsby.snap.yml
@@ -222,10 +222,12 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
61 | restless. Instead of being the warm centre of the world, the Middle West now
- | ^~~~~~ Did you mean `center`?
+ | ^~~~~~ Did you mean to spell `centre` this way?
62 | seemed like the ragged edge of the universe—so I decided to go East and learn
Suggest:
- Replace with: “center”
+ - Replace with: “censure”
+ - Replace with: “cent”
@@ -358,10 +360,12 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
120 | was a factual imitation of some Hôtel de Ville in Normandy, with a tower on one
- | ^~~~~ Did you mean `Vile`?
+ | ^~~~~ Did you mean to spell `Ville` this way?
121 | side, spanking new under a thin beard of raw ivy, and a marble swimming pool,
Suggest:
- Replace with: “Vile”
+ - Replace with: “Villa”
+ - Replace with: “Lille”
@@ -674,9 +678,10 @@ Lint: Spelling (63 priority)
Message: |
479 | thinking, but I doubt if even Miss Baker, who seemed to have mastered a certain
480 | hardy scepticism, was able utterly to put this fifth guest’s shrill metallic
- | ^~~~~~~~~~ Did you mean `skepticism`?
+ | ^~~~~~~~~~ Did you mean to spell `scepticism` this way?
Suggest:
- Replace with: “skepticism”
+ - Replace with: “asceticism”
@@ -1069,9 +1074,11 @@ Lint: Spelling (63 priority)
Message: |
730 | beauty, but there was an immediately perceptible vitality about her as if the
731 | nerves of her body were continually smouldering. She smiled slowly and, walking
- | ^~~~~~~~~~~ Did you mean `smoldering`?
+ | ^~~~~~~~~~~ Did you mean to spell `smouldering` this way?
Suggest:
- Replace with: “smoldering”
+ - Replace with: “shouldering”
+ - Replace with: “soldering”
@@ -1241,9 +1248,11 @@ Lint: Spelling (63 priority)
Message: |
923 | “I should change the light,” he said after a moment. “I’d like to bring out the
924 | modelling of the features. And I’d try to get hold of all the back hair.”
- | ^~~~~~~~~ Did you mean `modeling`?
+ | ^~~~~~~~~ Did you mean to spell `modelling` this way?
Suggest:
- Replace with: “modeling”
+ - Replace with: “modelings”
+ - Replace with: “yodeling”
@@ -1526,9 +1535,9 @@ Message: |
| ^~~~ Did you mean to spell `hors` this way?
1180 | spiced baked hams crowded against salads of harlequin designs and pastry pigs
Suggest:
+ - Replace with: “hours”
- Replace with: “hers”
- Replace with: “ho's”
- - Replace with: “hours”
@@ -1626,10 +1635,12 @@ Lint: Spelling (63 priority)
Message: |
1202 | confident girls who weave here and there among the stouter and more stable,
1203 | become for a sharp, joyous moment the centre of a group, and then, excited with
- | ^~~~~~ Did you mean `center`?
+ | ^~~~~~ Did you mean to spell `centre` this way?
1204 | triumph, glide on through the sea-change of faces and voices and color under the
Suggest:
- Replace with: “center”
+ - Replace with: “censure”
+ - Replace with: “cent”
@@ -1717,9 +1728,11 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
1310 | “I don’t think it’s so much that,” argued Lucille sceptically; “it’s more that
- | ^~~~~~~~~~~ Did you mean `skeptically`?
+ | ^~~~~~~~~~~ Did you mean to spell `sceptically` this way?
Suggest:
- Replace with: “skeptically”
+ - Replace with: “scenically”
+ - Replace with: “ascetically”
@@ -1738,18 +1751,21 @@ Lint: Spelling (63 priority)
Message: |
1347 | chance we tried an important-looking door, and walked into a high Gothic
1348 | library, panelled with carved English oak, and probably transported complete
- | ^~~~~~~~ Did you mean `paneled`?
+ | ^~~~~~~~ Did you mean to spell `panelled` this way?
Suggest:
- Replace with: “paneled”
+ - Replace with: “palled”
+ - Replace with: “Janelle”
Lint: Spelling (63 priority)
Message: |
1373 | Taking our scepticism for granted, he rushed to the bookcases and returned with
- | ^~~~~~~~~~ Did you mean `skepticism`?
+ | ^~~~~~~~~~ Did you mean to spell `scepticism` this way?
Suggest:
- Replace with: “skepticism”
+ - Replace with: “asceticism”
@@ -2159,10 +2175,12 @@ Lint: Spelling (63 priority)
Message: |
1764 | Again at eight o’clock, when the dark lanes of the Forties were lined five deep
1765 | with throbbing taxicabs, bound for the theatre district, I felt a sinking in my
- | ^~~~~~~ Did you mean `theater`?
+ | ^~~~~~~ Did you mean to spell `theatre` this way?
1766 | heart. Forms leaned together in the taxis as they waited, and voices sang, and
Suggest:
- Replace with: “theater”
+ - Replace with: “there”
+ - Replace with: “they're”
@@ -3147,9 +3165,11 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
2011 | “Major Jay Gatsby,” I read, “For Valour Extraordinary.”
- | ^~~~~~ Did you mean `Valor`?
+ | ^~~~~~ Did you mean to spell `Valour` this way?
Suggest:
- Replace with: “Valor”
+ - Replace with: “Valium”
+ - Replace with: “Valois”
@@ -3212,9 +3232,11 @@ Lint: Spelling (63 priority)
Message: |
2076 | Europe, and I was glad that the sight of Gatsby’s splendid car was included in
2077 | their sombre holiday. As we crossed Blackwell’s Island a limousine passed us,
- | ^~~~~~ Did you mean `somber`?
+ | ^~~~~~ Did you mean to spell `sombre` this way?
Suggest:
- Replace with: “somber”
+ - Replace with: “hombre”
+ - Replace with: “some”
@@ -3747,10 +3769,11 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
2455 | hard, limited person, who dealt in universal scepticism, and who leaned back
- | ^~~~~~~~~~ Did you mean `skepticism`?
+ | ^~~~~~~~~~ Did you mean to spell `scepticism` this way?
2456 | jauntily just within the circle of my arm. A phrase began to beat in my ears
Suggest:
- Replace with: “skepticism”
+ - Replace with: “asceticism”
@@ -4534,9 +4557,11 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
3319 | at the local club to-morrow, spoke in Miss Baedeker’s defence:
- | ^~~~~~~ Did you mean `defense`?
+ | ^~~~~~~ Did you mean to spell `defence` this way?
Suggest:
- Replace with: “defense”
+ - Replace with: “decency”
+ - Replace with: “deface”
@@ -4802,9 +4827,11 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
3599 | Gatsby stood in the centre of the crimson carpet and gazed around with
- | ^~~~~~ Did you mean `center`?
+ | ^~~~~~ Did you mean to spell `centre` this way?
Suggest:
- Replace with: “center”
+ - Replace with: “censure”
+ - Replace with: “cent”
@@ -5184,10 +5211,12 @@ Suggest:
Lint: Spelling (63 priority)
Message: |
3975 | could invent a protest the coupé came to a stop, and Daisy signalled us to draw
- | ^~~~~~~~~ Did you mean `signaled`?
+ | ^~~~~~~~~ Did you mean to spell `signalled` this way?
3976 | up alongside.
Suggest:
- Replace with: “signaled”
+ - Replace with: “signaler”
+ - Replace with: “signalized”
diff --git a/packages/vscode-plugin/src/tests/suite/integration.test.ts b/packages/vscode-plugin/src/tests/suite/integration.test.ts
index 49e3fce88..cbee90222 100644
--- a/packages/vscode-plugin/src/tests/suite/integration.test.ts
+++ b/packages/vscode-plugin/src/tests/suite/integration.test.ts
@@ -43,7 +43,7 @@ describe('Integration >', () => {
range: createRange(2, 26, 2, 32),
},
{
- message: 'Did you mean `realize`?',
+ message: 'Did you mean to spell `realise` this way?',
range: createRange(4, 26, 4, 33),
},
),
@@ -108,7 +108,7 @@ describe('Integration >', () => {
range: createRange(2, 26, 2, 32),
},
{
- message: 'Did you mean `realize`?',
+ message: 'Did you mean to spell `realise` this way?',
range: createRange(4, 26, 4, 33),
},
),