Skip to content

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

fix(core): fix indefinite article for "Euler" (#2211)

Lennard Hofmann64017175b9fe
diff --git a/harper-core/src/linting/an_a.rs b/harper-core/src/linting/an_a.rs
index c874f9a18..d9ae5d716 100644
--- a/harper-core/src/linting/an_a.rs
+++ b/harper-core/src/linting/an_a.rs
@@ -109,6 +109,10 @@ fn starts_with_vowel(word: &[char]) -> bool {
let word = to_lower_word(word);
let word = word.as_ref();
+ if matches!(word, ['e', 'u', 'l', 'e', ..]) {
+ return true;
+ }
+
if matches!(
word,
[] | ['u', 'k', ..]
@@ -224,6 +228,12 @@ mod tests {
assert_lint_count("Here is a LLM-based system.", AnA, 1);
}
+ #[test]
+ fn detects_euler_as_vowel() {
+ assert_lint_count("This is an Euler brick.", AnA, 0);
+ assert_lint_count("The graph has an Eulerian tour.", AnA, 0);
+ }
+
#[test]
fn capitalized_fourier() {
assert_lint_count("Then, perform a Fourier transform.", AnA, 0);