Skip to content

Commit

Permalink
[pt] add spelling tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaumeortola committed Oct 6, 2023
1 parent f3048f6 commit e869757
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public void testPortugalPortugueseSpelling() throws Exception {
Languages.getLanguageForShortCode("pt-PT"), null, null);
JLanguageTool lt = new JLanguageTool(Languages.getLanguageForShortCode("pt-PT"));

// CamelCase
assertEquals(1, rule.match(lt.getAnalyzedSentence("ShintaroW.")).length);
// all upper case
assertEquals(1, rule.match(lt.getAnalyzedSentence("SHINTAROW.")).length);

assertEquals(0, rule.match(lt.getAnalyzedSentence("A família.")).length);
RuleMatch[] matches = rule.match(lt.getAnalyzedSentence("A familia."));
assertEquals(1, matches.length);
Expand All @@ -43,6 +48,17 @@ public void testPortugalPortugueseSpelling() throws Exception {
assertEquals("autoconhecimento", matches[0].getSuggestedReplacements().get(0));
assertEquals(14, matches[0].getFromPos());
assertEquals(29, matches[0].getToPos());

matches = rule.match(lt.getAnalyzedSentence("Shintaro Wada"));
assertEquals(1, matches.length);
assertEquals("Sintamo", matches[0].getSuggestedReplacements().get(0));

matches = rule.match(lt.getAnalyzedSentence("Sr. Kato nos ensina inglês"));
assertEquals(1, matches.length);
assertEquals("Fato", matches[0].getSuggestedReplacements().get(0));
assertEquals(4, matches[0].getFromPos());
assertEquals(8, matches[0].getToPos());

}

public void testBrazilPortugueseSpelling() throws Exception {
Expand Down

0 comments on commit e869757

Please sign in to comment.