List<AnalyzedToken> taggerTokens;
List<AnalyzedToken> lowerTaggerTokens;
List<AnalyzedToken> upperTaggerTokens;
final List<AnalyzedTokenReadings> tokenReadings = new ArrayList<>();
int pos = 0;
final IStemmer dictLookup = new DictionaryLookup(getDictionary());
for (String word : sentenceTokens) {
final List<AnalyzedToken> l = new ArrayList<>();
final String lowerWord = word.toLowerCase(conversionLocale);
taggerTokens = asAnalyzedTokenList(word, dictLookup.lookup(word));
lowerTaggerTokens = asAnalyzedTokenList(word, dictLookup.lookup(lowerWord));
final boolean isLowercase = word.equals(lowerWord);
final boolean isMixedCase = StringTools.isMixedCase(word);
//normal case
addTokens(taggerTokens, l);
//tag non-lowercase (alluppercase or startuppercase), but not mixedcase word with lowercase word tags
if (!isLowercase && !isMixedCase) {
addTokens(lowerTaggerTokens, l);
}
//tag lowercase word with startuppercase word tags
if (tagLowercaseWithUppercase) {
if (lowerTaggerTokens.isEmpty() && taggerTokens.isEmpty()) {
if (isLowercase) {
upperTaggerTokens = asAnalyzedTokenList(word,
dictLookup.lookup(StringTools.uppercaseFirstChar(word)));
if (!upperTaggerTokens.isEmpty()) {
addTokens(upperTaggerTokens, l);
}
}
}