continue;
}
if (i > 0 && (tokens[i-1].getToken().equals("Herr") || tokens[i-1].getToken().equals("Herrn") || tokens[i-1].getToken().equals("Frau")) ) { // "Frau Stieg" could be a name, ignore
continue;
}
final AnalyzedGermanTokenReadings analyzedToken = (AnalyzedGermanTokenReadings)tokens[i];
final String token = analyzedToken.getToken();
List<AnalyzedGermanToken> readings = analyzedToken.getGermanReadings();
AnalyzedGermanTokenReadings analyzedGermanToken2;
boolean isBaseform = false;
if (analyzedToken.getReadingsLength() >= 1 && analyzedToken.hasLemma(token)) {
isBaseform = true;
}
if ((readings == null || analyzedToken.getAnalyzedToken(0).getPOSTag() == null || analyzedToken.hasReadingOfType(GermanToken.POSType.VERB))
&& isBaseform) {
// no match, e.g. for "Groß": try if there's a match for the lowercased word:
analyzedGermanToken2 = tagger.lookup(token.toLowerCase());
if (analyzedGermanToken2 != null) {
readings = analyzedGermanToken2.getGermanReadings();
}
boolean nextTokenIsPersonalPronoun = false;
if (i < tokens.length - 1) {
// avoid false alarm for "Das haben wir getan." etc:
nextTokenIsPersonalPronoun = tokens[i + 1].hasPartialPosTag("PRO:PER") || tokens[i + 1].getToken().equals("Sie");
}
potentiallyAddLowercaseMatch(ruleMatches, tokens[i], prevTokenIsDas, token, nextTokenIsPersonalPronoun);
}
prevTokenIsDas = nounIndicators.contains(tokens[i].getToken().toLowerCase());
if (readings == null) {
continue;
}
final boolean hasNounReading = analyzedToken.hasReadingOfType(GermanToken.POSType.NOMEN);
if (hasNounReading) { // it's the spell checker's task to check that nouns are uppercase
continue;
}
// TODO: this lookup should only happen once:
analyzedGermanToken2 = tagger.lookup(token.toLowerCase());
if (analyzedToken.getAnalyzedToken(0).getPOSTag() == null && analyzedGermanToken2 == null) {
continue;
}
if (analyzedToken.getAnalyzedToken(0).getPOSTag() == null && analyzedGermanToken2 != null
&& analyzedGermanToken2.getAnalyzedToken(0).getPOSTag() == null) {
// unknown word, probably a name etc
continue;
}
potentiallyAddUppercaseMatch(ruleMatches, tokens, i, analyzedToken, token);
}