private static Map<String, String> generatePOSTags(Question q) { ParseTree parse = new ParseTree(); DEPTree tree = parse.process(q); // TODO this is horribly wrong, the same label CAN have different pos // tags Map<String, String> label2pos = Maps.newHashMap(); Stack<DEPNode> stack = new Stack<DEPNode>(); stack.push(tree.getFirstRoot()); while (!stack.isEmpty()) { DEPNode tmp = stack.pop(); label2pos.put(tmp.form, tmp.pos); for (DEPNode child : tmp.getDependentNodeList()) { stack.push(child); } } return label2pos; }