if (coref.startsWith("("))
{
if (coref.endsWith(")"))
{
key = coref.substring(1, coref.length()-1);
mentions.add(new Mention(key, i+1, i+1));
}
else
{
key = coref.substring(1);
stack = map.get(key);
if (stack == null)
{
stack = new IntStack();
map.put(key, stack);
}
stack.push(i+1);
}
}
else //if (coref.endsWith(")"))
{
key = coref.substring(0, coref.length()-1);
mentions.add(new Mention(key, map.get(key).pop(), i+1));
}
}
}
return mentions;