// initialize the mapping of nodes to markables, as well as the set of all markables so we know
// how many of them we've found
for(Annotation a : lm){
if(a.getBegin() > m.getBegin()) break;
// if(sentDist(jcas,m,(Markable)a) > 3) continue;
TreebankNode n = MarkableTreeUtils.markableNode(jcas, a.getBegin(), a.getEnd());
node2mark.put(n, (Markable)a);
allMarks.add((Markable)a);
}
// find out what sentence we're at to make it easier to go backwards:
for(int i = 0; i < sentList.size(); i++){
Annotation a = sentList.get(i);
if(m.getBegin() >= a.getBegin() && m.getEnd() <= a.getEnd()){
sentInd = i;
break;
}
}
TreebankNode node = MarkableTreeUtils.markableNode(jcas, m.getBegin(), m.getEnd());
TreebankNode Y = node;
TreebankNode X = HobbsTreeNavigator.nextX(node);
if(X != null){
// Step 3: Traverse left side of X
// First add the children to the left to the queue
// Queue<TreebankNode> q = new LinkedList<TreebankNode>();
Queue<TreebankNode> q = HobbsTreeNavigator.initializeQueue(X, Y);
LinkedList<TreebankNode> tempList = HobbsTreeNavigator.bfs(q, X, Y);
// before adding to actual queue (ll), need to make sure each of these has an NP node between it and X
for(TreebankNode cur : tempList){
TreebankNode n = cur.getParent();
while(n != null && n != X){
if(n.getNodeType().equals("NP") || n.getNodeType().equals("S")){
if(node2mark.containsKey(n)){
ll.add(node2mark.get(n));
allMarks.remove(node2mark.get(n));
break;
}
}
n = n.getParent();
}
}
if(allMarks.size() == 0) return ll;