Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[de] make entries in prohibit.txt work when followed by dot #10746

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2286,16 +2286,17 @@ && isMisspelled(word)

@Override
protected boolean ignorePotentiallyMisspelledWord(String word) throws IOException {
if (isValidWordLength(word) || startsWithLowercase(word) || isProhibited(word)) {
// Remove dot
String wordNoDot = word.endsWith(".") ? word.substring(0, word.length()-1) : word;

if (isValidWordLength(word) || startsWithLowercase(word) || isProhibited(word) || isProhibited(wordNoDot)) {
// Exclude cases like weird/irrelevant words and very long words that can cause crashes
return false;
}
// Check for words that are likely to be typos
if (isProbablyTypo(word)) {
return false;
}
// Remove dot
String wordNoDot = word.endsWith(".") ? word.substring(0, word.length()-1) : word;

// Format gender neutral forms here to make splitting easier, but
// we need to double-check the word later to avoid words in camel case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ public void testMultitokenSpelling() throws IOException {
assertThat(lt.check("Groß Oessingen").size(), is(1));
assertThat(lt.check("Eching am Ammerse").size(), is(2));
}

@Test
public void testProhibitedWordFollowedByDot() throws IOException {
JLanguageTool lt = new JLanguageTool(Languages.getLanguageForShortCode("de-DE"));
assertThat(lt.check("Bestanteil.").size(), is(1));
}
}