boolean hasExtendedLatin = false;
boolean hasHyperextendedLatin = false;
final Counter<UnicodeBlock> counter = new Counter<UnicodeBlock>();
for (final String word : words)
{
final UnicodeBlock block = getBlock(word);
if (block == UnicodeBlock.LATIN_1_SUPPLEMENT)
{
hasExtendedLatin = true;
}
if (block == UnicodeBlock.LATIN_EXTENDED_A)
{
hasHyperextendedLatin = true;
}
counter.note(block);
}
final List<UnicodeBlock> mostFrequent = counter.getMostFrequent(1);
if (mostFrequent.size() == 0)
{
return null;
}
UnicodeBlock b = mostFrequent.get(0);
/*
* If we've seen *any* extended latin, and we're mostly latin, then
* treat the whole thing as extended.
*/
if (b == UnicodeBlock.BASIC_LATIN || b == UnicodeBlock.LATIN_1_SUPPLEMENT)