From 5edbd58fcdc04db7dc114c4cfaea96bd9dc9372f Mon Sep 17 00:00:00 2001 From: p-goulart Date: Thu, 12 Oct 2023 16:13:45 +0200 Subject: [PATCH] [pt] Add speller tests for hyphenated pronouns --- .../MorfologikPortugueseSpellerRuleTest.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/languagetool-language-modules/pt/src/test/java/org/languagetool/rules/pt/MorfologikPortugueseSpellerRuleTest.java b/languagetool-language-modules/pt/src/test/java/org/languagetool/rules/pt/MorfologikPortugueseSpellerRuleTest.java index ca0bda438622..48a480d4a9b9 100644 --- a/languagetool-language-modules/pt/src/test/java/org/languagetool/rules/pt/MorfologikPortugueseSpellerRuleTest.java +++ b/languagetool-language-modules/pt/src/test/java/org/languagetool/rules/pt/MorfologikPortugueseSpellerRuleTest.java @@ -58,6 +58,13 @@ private void assertSingleError(String sentence, JLanguageTool lt, assertErrorLength(sentence, 1, lt, rule, suggestions); } + private void assertTwoWayDialectError(String sentenceBR, String sentencePT) throws IOException { + assertNoErrors(sentenceBR, ltBR, ruleBR); + assertSingleError(sentenceBR, ltPT, rulePT, new String[]{sentencePT}); + assertNoErrors(sentencePT, ltPT, rulePT); + assertSingleError(sentencePT, ltBR, ruleBR, new String[]{sentenceBR}); + } + @Test public void testBrazilPortugueseSpelling() throws Exception { assertSingleError("ShintaroW.", ltBR, ruleBR, new String[]{}); @@ -75,6 +82,23 @@ public void testBrazilPortugueseSpelling() throws Exception { assertSingleErrorAndPos("Sr. Kato nos ensina inglês", ltBR, ruleBR, new String[]{"Fato"}, 4, 8); } + @Test + public void testPortugueseHyphenatedClitics() throws Exception { + assertNoErrors("diz-se", ltBR, ruleBR); + assertNoErrors("fá-lo-á", ltBR, ruleBR); + assertNoErrors("dir-lhe-ia", ltBR, ruleBR); + assertNoErrors("amar-nos-emos", ltBR, ruleBR); + assertNoErrors("dê-mo", ltBR, ruleBR); + } + + // these are obviously failing for now + @Test + public void testPortugueseSymmetricalDialectDifferences() throws Exception { + assertTwoWayDialectError("anônimo", "anónimo"); + assertTwoWayDialectError("detecção", "deteção"); + assertTwoWayDialectError("dezesseis", "dezasseis"); + } + @Test public void testBrazilPortugueseSpellingDoesNotCheckHashtags() throws Exception { assertNoErrors("#CantadaBoBem", ltBR, ruleBR); @@ -126,6 +150,7 @@ public void testBrazilPortugueseSpellingWorksWithRarePunctuation() throws Except assertNoErrors("″Santo Antônio do Manga″", ltBR, ruleBR); } + // TODO: get rid of this test, of course @Test public void testBrazilPortugueseSpellingMorfologikWeirdness() throws Exception { // 'ja' not corrected to 'já'!