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 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 @@ -2215,6 +2215,18 @@ protected boolean ignorePotentiallyMisspelledWord(String word) throws IOExceptio
List<String> parts = compoundTokenizer.tokenize(wordNoDot);
boolean nonStrictMode = false;
if (parts.size() == 1) {
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 🙃

}
parts = nonStrictCompoundTokenizer.tokenize(wordNoDot);
nonStrictMode = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61678,4 +61678,7 @@ Petruskreuze/SN
Pileolus
Pileoli
Pentalpha/S
Römerkragen/S
Römerkragen/S
Alexander-von-Humboldt-Realschule
Augsburg-Haunstetten-Siebenbrunn
Denavit-Hartenberg-Parameter/S
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,5 @@ Werbeanbringung
Wohlgeformtheit
Anomalität
Dämmerung
Studiengang
Studiengang
Ayurveda
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,80 @@ 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-
Afro-
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
Vehicle-to-Grid-
Best-Practice-
Agri-Photovoltaik-
Face-to-Face-
CBD-
Hausstaubmilben
Cradle-to-Cradle-
Heavy-Metal-
Akkusativ
Dativ
Genitiv
Nominativ
Due-Diligence-
Deep-Learning-
Transformer-
Elektrolyse
Gebrauchshund
EU-Mercosur-
Go-To-Market
Feedback
Pop-Up-
Pop-
.com-
Business-to-Business-
B2B-
Geflüchteten
Coming-Home-
Gourmet
Betroffenen
E-Commerce
Adjektiv
Karaoke
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public class GermanSpellerRuleTest {
@Test
public void testIgnoreMisspelledWord() throws IOException {
GermanSpellerRule rule = new GermanSpellerRule(TestTools.getMessages("de"), GERMAN_DE);
assertTrue(rule.ignorePotentiallyMisspelledWord("Farm-to-Fork-Bereich"));
assertFalse(rule.ignorePotentiallyMisspelledWord("Englisch-KenntnisseWeitere"));
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