Skip to content

Commit

Permalink
[pt] Add speller tests for hyphenated pronouns
Browse files Browse the repository at this point in the history
  • Loading branch information
p-goulart committed Oct 16, 2023
1 parent 9f46b6e commit 5edbd58
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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[]{});
Expand All @@ -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);
Expand Down Expand Up @@ -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á'!
Expand Down

0 comments on commit 5edbd58

Please sign in to comment.