// iterate over each entity Triple
for (Triple<String, Integer, Integer> extractedEntity : extractedEntities) {
// check if the entity is a "Location"
if (extractedEntity.first.equalsIgnoreCase("LOCATION")) {
// build a LocationOccurrence object
LocationOccurrence location = new LocationOccurrence(
text.substring(extractedEntity.second(), extractedEntity.third()),
extractedEntity.second());
// filter out demonyms
if (!demonyms.contains(location.text))
// add it to the list of extracted locations