languagetool-org / languagetool

Style and Grammar Checker for 25+ Languages
https://languagetool.org
GNU Lesser General Public License v2.1
11.85k stars 1.38k forks source link

[en] missing suggestion with "apostrophe + s" #2031

Open tiff opened 4 years ago

tiff commented 4 years ago

Where is Michaels new song?

Bildschirmfoto 2019-10-15 um 16 25 47

I think this is a very common error, and we don't suggest "Michael's".

tiff commented 4 years ago

It gets even worse:

Bildschirmfoto 2019-10-15 um 16 41 14
tiff commented 4 years ago

I think as a first small improvement we could do the following: If the word is unknown (like "Michaels"), ends with an "s" and the next word is a noun or an adjective, then we should check if the word without "s" is known as a noun and suggest it with 's

tiff commented 4 years ago

Another one, where no error is found

My friends new car is awesome.

This one should be detectable through POS (combination of NNS and "is/has/was/ ...")

tiff commented 4 years ago

Related rule: POSSESSIVE_APOSTROPHE

MikeUnwalla commented 4 years ago

A possible alternative suggestion is Michaels' .

"Michaels" is an English surname (https://en.wikipedia.org/wiki/Michaels_(surname) )

If the word is unknown (like "Michaels"), ends with an "s"

If we add postag NNP to Michaels, your suggestion won't work. Thus, I am not sure whether to add the postag.

danielnaber commented 4 years ago

There will be quite some no-so-good suggestions with names, see Wikipedia run attached. But as it's just about the suggestion and current state is bad, I'll commit my change. Will not work for "Googles", BTW, as that is accepted. "Michaels" and "Microsoft" should work.

possessive_issue2031_filtered.txt

tiff commented 4 years ago

Looks to me as if there's just the NN(P)S tag and spelling is missing for the terms in your .txt. Should be easy to fix.

tiff commented 4 years ago

@danielnaber the functionality you built here probably got lost (due to the resorting?).

compare first (languagetool.org) vs second (languagetoolplus.com) Bildschirmfoto 2020-04-30 um 15 13 20 Bildschirmfoto 2020-04-30 um 15 13 29

danielnaber commented 4 years ago

I have committed a quick fix, but Simon's is at position 2, not 1. It seems the suggestions with type SuggestionType.Curated (Simon and Simon's in this case) are kept at the top of the list, but still-resorted among each other. @fabrichter We can change the algorithm so that if both words in the comparator are Curated, we keep the original order, can't we?

danielnaber commented 4 years ago

Plus, we obviously need more service-level tests...