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] improve germanSpeller #9821

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -2217,6 +2217,18 @@ protected boolean ignorePotentiallyMisspelledWord(String word) throws IOExceptio
if (parts.size() == 1) {
parts = nonStrictCompoundTokenizer.tokenize(wordNoDot);
nonStrictMode = true;
AgnesKleinhans marked this conversation as resolved.
Show resolved Hide resolved
String part2 = " ";
for (String w : wordsWithoutInfixS) { // wordsWithHyphen
if (word.startsWith(w)) {
part2 = word.substring(w.length());
if (part2.startsWith("-")) {
part2 = part2.substring(1);
} else if (word.length() > w.length() && w.length() > 3) {
part2 = uppercaseFirstChar(part2.substring(0));
}
return (!isMisspelled(part2) || ignorePotentiallyMisspelledWord(part2)) && isNoun(part2);
}
Comment on lines +2218 to +2228
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stretch looks over-indented 🙃

}
}
String part1;
String part2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ Teich
Trail
Villa
Vinyl
Wacht
Yacht
Kirmes
Gewächs
Expand Down Expand Up @@ -1756,8 +1755,47 @@ Multizellen
Aminosäuren
Ausreißer
Drehzahl
Absenk
Gastro
Ausdauer
Anthropomorphismus
Charles-Bonnet-Syndrom
Charles-Bonnet-Syndrom
Allergie
Trüffel
Fondue
Buddha
Zellulose
Angehörigen
Anthropomorphismus
Waffel
Black-Friday-
Anti-
All-in-One-
Remote-Work-
American-Football-
All-you-can-eat-
Double-Opt-In-
Cash-Conversion-
Al-Shifa-
Anti-Stokes–
Farm-to-Fork
Afro-Pop-
Backup-Restore-
Before-Class-
Make-up-
Always-on-
Fake-
Build-to-Order-
Air-Asia-
Airport-
Workshop-
Continuous-Improvement-
Above-the-Fold-
CDU-
SPD-
AfD-
E-Commerce-Conversion-
E-Commerce-
Black-Week-
Boho-
Charles-Bonnet-
Allergiker
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class GermanSpellerRuleTest {
@Test
public void testIgnoreMisspelledWord() throws IOException {
GermanSpellerRule rule = new GermanSpellerRule(TestTools.getMessages("de"), GERMAN_DE);
assertTrue(rule.ignorePotentiallyMisspelledWord("Black-Friday-Schnäppchen"));
AgnesKleinhans marked this conversation as resolved.
Show resolved Hide resolved
assertTrue(rule.ignorePotentiallyMisspelledWord("Atmosphärenkonzept"));
assertTrue(rule.ignorePotentiallyMisspelledWord("Wölkchenbildung"));
assertFalse(rule.ignorePotentiallyMisspelledWord("Abschlussgruße")); // probably "...grüße"
Expand Down