List<List<AbstractCoreLabel>> namedEntities = Generics.newArrayList();
List<AbstractCoreLabel> ne = Generics.newArrayList();
String previousNEType = "";
int previousNEIndex = -1;
for (int i = 0; i < words.size(); i++) {
AbstractCoreLabel word = words.get(i);
if(!word.ner().equals("O")) {
if (!word.ner().equals(previousNEType) || previousNEIndex != i-1) {
ne = Generics.newArrayList();
namedEntities.add(ne);
}
ne.add(word);
previousNEType = word.ner();
previousNEIndex = i;
}
}
List<String> neStrings = new ArrayList<String>();