/** Divides a sentence into clauses and sorts the antecedents for pronoun matching. */
private static List<Mention> sortMentionsForPronoun(List<Mention> l, Mention m1, boolean sameSentence) {
List<Mention> sorted = new ArrayList<Mention>();
if (sameSentence) {
Tree tree = m1.contextParseTree;
Tree current = m1.mentionSubTree;
current = current.parent(tree);
while (current != null) {
if (current.label().value().startsWith("S")) {
for (Mention m : l) {
if (!sorted.contains(m) && current.dominates(m.mentionSubTree)) {
sorted.add(m);
}
}
}
current = current.parent(tree);
}
if (SieveCoreferenceSystem.logger.isLoggable(Level.FINEST)) {
if (l.size()!=sorted.size()) {
SieveCoreferenceSystem.logger.finest("sorting failed!!! -> parser error?? \tmentionID: "+m1.mentionID+" " + m1.spanToString());
sorted = l;