Automattic / Automattic/harper

`closed_compounds` doesn't handle inflected forms

Open
#2,267 0 comments 0 reactions 0 assignees View on GitHub
bug linting
Dominant language
Rust
Stars
15.4k
Forks
627
Avg merge
1d 15h
Merged PRs (30d)
106

Description

**Describe the bug**
`linting/closed_compounds.rs` closes compounds incorrectly written with a space between the parts that shouldn't be there: "any body", "desk top", "under clock", etc.

But it ignores inflected forms: "any body's", "desk tops", "under clocking", etc.

**To Reproduce**
Steps to reproduce the behavior:
1. Type something like "I bought another lap top so now I have two lap tops."
2. Notice that only the singular form is flagged with the suggestion `Did you mean the closed compound noun “laptop”?`

**Expected behavior**
All related forms should be corrected.

**Screenshots**

Image

**Additional context**

Since it's implemented as a macro that assigns a name for a setting for a single mapping, it would be clunky to have to have separate settings `Desktop` and `Desktops`. Rather a solution similar to how I split `phrase_set_corrections` off from `phrase_corrections` would allow all forms of a term to be corrected under a single setting in the options.

Contributor guide

Open the contributing guide

Research direction

Start in linting/closed_compounds.rs and reproduce the reported singular/plural behavior with “lap top” and “lap tops.” Then compare the existing phrase_set_corrections and phrase_corrections approach to determine how related inflected forms can share one setting; done means all related forms receive the closed-compound suggestion.

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
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.