languagetool-org / languagetool

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

Auto uppercase bug #7610

Open ghost opened 1 year ago

ghost commented 1 year ago

After trying to adjust a rule, a bug showed: [ERROR] Errors: [ERROR] DutchPatternRuleTest>PatternRuleTest.lambda$testGrammarRulesFromXML$2:519->PatternRuleTest.testBadSentences:640->PatternRuleTest.assertSuggestions:748->PatternRuleTest.addError:484 » PatternRuleTestFailure Test failure for rule SAMENSTELLING_EIGENNAAM[1] in file /org/languagetool/rules/nl/grammar.xml: Incorrect suggestions: Expected 'K3-jurk|jurk van K3', got: 'K3-jurk|Jurk van K3' on input: 'Het is een K3 jurk.' [INFO] [ERROR] Tests run: 28, Failures: 0, Errors: 1, Skipped: 1

The relevant part of the rule is:

                <suggestion>\2-\3</suggestion>
                <suggestion>\3 van \2</suggestion>

Somehow the lowercase 'jurk' is auto capitalized in the suggestion, because word 1 has a capital. This is wrong, and makes the rule fail.

danielnaber commented 1 year ago

Would <suggestion>\2-<match no="3" case_conversion="alllower"/></suggestion> solve this?

ghost commented 1 year ago

Not in all cases. Maybecwhen the rule is split into several ones, depending on case. Actually, Iadjusted the rule to only offer the variant with hyphen. That one is alwys correct, in some cases suboptimal, but acceptable. Will have to see how it performs.