Skip to content

Commit

Permalink
[de] add test for ignoring English words
Browse files Browse the repository at this point in the history
  • Loading branch information
jaumeortola committed May 29, 2024
1 parent f278a07 commit f068ca9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ protected String getSentenceTextWithoutUrlsAndImmunizedTokens(AnalyzedSentence s
AnalyzedTokenReadings[] sentenceTokens = getSentenceWithImmunization(sentence).getTokens();
for (int i = 1; i < sentenceTokens.length; i++) {
String token = sentenceTokens[i].getToken();
if (sentenceTokens[i].isImmunized() || sentenceTokens[i].isIgnoredBySpeller() || isUrl(token) || isEMail(token) || isQuotedCompound(sentence, i, token)) {
if (sentenceTokens[i].isImmunized() || sentenceTokens[i].isIgnoredBySpeller() || isUrl(token) || isEMail(token)
|| isQuotedCompound(sentence, i, token) || sentenceTokens[i].hasPosTag("_english_ignore_")) {
if (isQuotedCompound(sentence, i, token)) {
sb.append(' ').append(token.substring(1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,4 +603,12 @@ public void testIgnoreEnglishWordsInPortuguese() throws IOException {
}
}

@Test
public void testIgnoringEnglishWordsInGerman() throws IOException {
Language lang = new GermanyGerman();
JLanguageTool lt = new JLanguageTool(lang);
List<RuleMatch> matches = lt.check("This is an English sentence.");
assertEquals(0, matches.size());
}

}

0 comments on commit f068ca9

Please sign in to comment.