Created
October 24, 2020 21:14
-
-
Save danielnaber/686f6ef361da1f2240ebf514b0873a00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SpecialCaseFinder { | |
public static void main(String[] args) throws IOException { | |
List<String> lines = Files.readAllLines(Paths.get("/home/dnaber/lt/git/german-pos-dict/x")); | |
GermanSpellerRule speller = new GermanSpellerRule(JLanguageTool.getMessageBundle(), new GermanyGerman()); | |
int i = 1; | |
for (String line : lines) { | |
if (line.matches("[A-ZÖÄÜ].*") && line.endsWith("er") && !speller.isMisspelled(line)) { | |
String shortened = line.replaceAll("er$", ""); | |
if (!speller.isMisspelled(shortened)) { | |
String generated = shortened + "erz"; | |
if (!speller.isMisspelled(generated)) { | |
System.out.println(i + " " + line + " " + shortened + " " + generated); | |
i++; | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment