fix(core): don't flag MissingTo after a possessive nominal - #4089
fix(core): don't flag MissingTo after a possessive nominal#4089mauropereiira wants to merge 1 commit into
MissingTo after a possessive nominal#4089Conversation
`MissingTo` read "aims" in "This Article's aims are ..." as a verb wanting an infinitive, because the token is noun/verb ambiguous and the tagger defaults it to VERB. A controller preceded by a possessive is a noun in a noun phrase, not a predicate. Suppress noun-capable controllers immediately preceded by a possessive nominal. The existing positives have no preceding possessive and are unaffected. Fixes Automattic#3951 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Oh this is the kind of thing that made me never comfortable with using But perhaps we should start a new issue specifically gathering places like this where it fails so that it can be improved at some point?
Yes "is" is unique in that it has more forms than all other English verbs and its agreement rules are more involved. At some point we might want to have a good think about whether we want a special Apologies for not diving deep into the rest of this PR. Just adding some thoughts for now as there's a ton of new issues and PRs to look at... |
Issues
Fixes #3951
Description
MissingToflagged "This Article's aims are both theoretical and historical.", wanting an infinitive after "aims".The cause is a chain of defaults rather than one bug:
UPOS::VERB.So the pattern accepts "aims are", and nothing in the rule looked left. As the reporter put it, the rule pattern-matches the token without resolving its part of speech from the frame it sits in:
X's aims are, notX aims to.The guard is structural. A noun-capable controller immediately preceded by a possessive nominal is the head of a noun phrase, not a predicate missing an infinitive:
This covers possessive nouns like "Article's" as well as possessive determiners, without keying on any specific word.
I also considered guarding on the following token being a finite verb, and rejected it: Harper cannot generally separate a finite base form from an infinitive using UPOS alone, so it would have suppressed legitimate missing-
tocases before infinitive auxiliaries such as "be".Demo
How Has This Been Tested?
cargo test -p harper-coreEach existing positive in
missing_to.rswas checked against the guard; none has a preceding possessive nominal, so all remain eligible. No files underharper-core/tests/text/change.AI Disclosure
If Your PR Implements or Enhances a Linter
Checklist