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... |
|
No worries on the review, and thanks for the thoughts. Three of these I could answer from the code since I had it open. Does it still fail "the cat sat on the mat"? Yes, on the last word: It looks lexical rather than contextual. Dictionary POS or external? External, and it wins. From let mut found_meta = dictionary
.get_word_metadata(word_source)
.map(|c| c.into_owned());
if let Some(inner) = &mut found_meta {
inner.pos_tag = token_tags[ti].or_else(|| inner.infer_pos_tag());
inner.np_member = Some(np_flags[ti]);
}The dictionary lookup runs first, then On a On opening an issue to gather UPOS failures: worth doing, and I think part of it can be mechanized. Tagger versus dictionary disagreement is checkable in bulk. I ran 400 random dictionary words through the fixed frame The disagreement cuts both ways, though. In a Happy to open it with this as the starting batch if you want it. |
|
Thanks for the summary on how the Brill tagger works. Interesting.
Yeah that's a
Interesting. I also did the "cat sat on the mat" test with |
|
You're right, I answered the wrong question. The model you named is already sitting there in the shape you'd want, though. The gap a
5,380 lines including their tests. On Both hard parts you named are already recorded there, as skipped tests in On the mat test with So "the mat" comes out as a determiner with nothing attached to it. I don't think that's a second bug, though. In let token_tags = tagger.tag_sentence(&token_strings);
let np_flags = chunker.chunk_sentence(&token_strings, &token_tags);
The structural pattern doesn't reproduce the split. Stable across the pair, but it reads "cat" as a modifier and "sat" as the head, so I don't think it would serve as a fallback here. ("A red apple" still comes out right, for what it's worth.) Opened the tagger issue as #4150. I regenerated the sweep against current master rather than reusing last week's batch, and the |
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