package edu.emory.mathcs.nlp.emorynlp.srl;
import java.lang.reflect.Array;
import java.util.*;
import edu.emory.mathcs.nlp.emorynlp.component.node.NLPNode;
public class quiz6 {
public List<NLPNode> getArgumentCandidateList(NLPNode[] nodes, int predicateID)
{
List<NLPNode> list = new ArrayList<NLPNode>();
NLPNode predicate = nodes[predicateID];
//dependents
List<NLPNode> dependents = predicate.getSubNodeList();
for (NLPNode dependent : dependents) {
if (!dependent.equals(predicate))
list.add(dependent);
}
//dependents of the ancesstors
NLPNode ancestor = predicate.getDependencyHead();
while (!ancestor.equals(null)){
dependents = ancestor.getDependentList();
for (NLPNode dependant : dependents) {
if(!list.contains(dependant) && !dependant.equals(predicate))
list.add(dependant);
}
predicate = ancestor;
ancestor = ancestor.getDependencyHead();
}
return list;
}
}