Skip to content

Instantly share code, notes, and snippets.

@danielnaber
Created October 24, 2020 21:14
Show Gist options
  • Save danielnaber/686f6ef361da1f2240ebf514b0873a00 to your computer and use it in GitHub Desktop.
Save danielnaber/686f6ef361da1f2240ebf514b0873a00 to your computer and use it in GitHub Desktop.
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