Automattic / Automattic/harper

feat: Flag the verb agreeing with the closest noun rather than the head of the noun phrase

Open
#436 5 comments 0 reactions 0 assignees View on GitHub
agreement enhancement harper-core linting
Dominant language
Rust
Stars
15.4k
Forks
627
Avg merge
1d 15h
Merged PRs (30d)
106

Description

Both native speakers and non-native speakers make this mistake. I'm assuming native speakers usually do it when editing, when overthinking or second-guessing their grammar, or when trusting a simplistic grammar checker!
- Adding the 4,084 **bytes** at the beginning **allow for** additional text → **Adding** the 4,084 bytes at the beginning **allows for** additional text.

Native speakers do this rarely in speech but it's generally a pretty reliable way to tell that somebody is reading from a script.

I'm assuming this will be hard to implement! It will probably require building a parse tree rather than just scanning spans of words.

Here are some related online articles/references:
- [On Notional Agreement, the Majority Speak](https://www.merriam-webster.com/grammar/notional-agreement-subject-verb-principle-proximity)
- [Agreeing to Disagree: Why We Use "Notional" Agreement
](https://www.vocabulary.com/articles/wc/agreeing-to-disagree-why-we-use-notional-agreement/)

I don't know how well commercial grammar checkers handle this, but note that current generation LLM-based AIs don't do this and can fix it when asked:
Image

Contributor guide

Open the contributing guide

Research direction

Start by locating the subject–verb agreement checks and determine how noun phrases are currently represented. Use the “Adding the 4,084 bytes...” example and the linked agreement references to define the expected behavior; done means the checker flags agreement based on the closest noun where appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.