Automattic / Automattic/harper

Indefinite article a/an inconsistently false-positive'd when followed by all-caps dictionary word

Open
#3,921 11 comments 1 reaction 0 assignees View on GitHub
bug false-positive harper-core linting
Dominant language
Rust
Stars
15.4k
Forks
627
Avg merge
1d 15h
Merged PRs (30d)
102

Description

**What got flagged?**

```
a FREE event
```

Harper wants to change "a" to "an"

**Why is this incorrect?**

"FREE" in this instance is just a word uppercased for emphasis. Harper is treating it like an initialism and then going "ah well F has a 'eff' sound so that should get 'an'"

I dug into this a little more and it looks like the likely-acronym check is incredibly crude - it picks up FREE as _not_ an acronym specifically because it's at least 3 letters and _doesn't_ start with a consonant immediately followed by a vowel (as opposed to, say, "NEW" which doesn't trigger the same false-positive)

I'm fairly new to Harper so apologies if this is a stupid suggestion but - instead of the acronym check just looking at the vowel-ness of the first two characters, would it not make sense to check if it's a fully-uppercased dictionary word, and if so, assume acronym rather than initialism?

Just based on my own gut feel, I suspect that any all-caps dictionary word that's more than a few letters long, is far more likely to be pronounced as a word rather than as an initialism even if it _is_ an abbreviation (the example that immediately came to mind was "James Bond deals with a SPECTRE agent" - Harper currently flags the "a" here)

Possibly related issue: #534 which also seems to be related to acronyms/initialisms and a/an (although that one seems to be more about a far more ambiguous case, not sure if it overlaps)

Contributor guide

Open the contributing guide

Research direction

Start by tracing the likely-acronym check described in the issue and reproduce the `a FREE event` and `a SPECTRE agent` cases. Done means all-caps dictionary words are not incorrectly treated as initialisms, while genuine initialism cases and the existing `NEW` behavior remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.