// Initialize Token / Sentence info for the ClearParser Semantic Role Labeler
for (int i = 0; i < tokens.size(); i++) {
BaseToken token = tokens.get(i);
// Determine HeadId
DepNode node = new DepNode();
ConllDependencyNode casDepNode = JCasUtil.selectCovered(jCas, ConllDependencyNode.class, token).get(0);
casDepNode.getDeprel();
String headRelation = casDepNode.getDeprel();
ConllDependencyNode head = casDepNode.getHead();
// If there is no head, this is the head node, set node to 0
int headId = (head == null) ? 0 : depNodeToID.get(head);
// Populate Dependency Node / Tree information
node.id = i + 1;
node.form = token.getCoveredText();
node.pos = token.getPartOfSpeech();
node.lemma = useLemmatizer ? "" : token.getNormalizedForm();
node.setHead(headId, headRelation, 0);
tree.add(node);
}
tree.setPredicates(AbstractReader.LANG_EN);
// Run the SRL