terminal.setNodeValue(line.word); terminal.setChildren(new FSArray(jCas, 0)); terminal.setLeaf(true); terminal.addToIndexes(); terminals.add(terminal);
terminal.setNodeValue(line.word); terminal.setChildren(new FSArray(jCas, 0)); terminal.setLeaf(true); terminal.addToIndexes(); terminals.add(terminal);
/** * Create a leaf TreebankNode in a JCas. * * @param jCas * The JCas which the annotation should be added to. * @param begin * The begin offset of the node. * @param end * The end offset of the node. * @param nodeType * The part of speech tag of the node. * @return The TreebankNode which was added to the JCas. */ public static TreebankNode newNode(JCas jCas, int begin, int end, String nodeType) { TreebankNode node = new TreebankNode(jCas, begin, end); node.setNodeType(nodeType); node.setChildren(new FSArray(jCas, 0)); node.setLeaf(true); node.addToIndexes(); return node; }
private void addTreebankNodeToIndexes( TreebankNode node, JCas jCas, Tree tree, List<CoreLabel> tokenAnns) { // figure out begin and end character offsets CoreMap label = (CoreMap) tree.label(); CoreMap beginToken = tokenAnns.get(label.get(BeginIndexAnnotation.class)); CoreMap endToken = tokenAnns.get(label.get(EndIndexAnnotation.class) - 1); int nodeBegin = beginToken.get(CharacterOffsetBeginAnnotation.class); int nodeEnd = endToken.get(CharacterOffsetEndAnnotation.class); // set span, node type, children (mutual recursion), and add it to the JCas node.setBegin(nodeBegin); node.setEnd(nodeEnd); node.setNodeType(tree.value()); node.setChildren(this.addTreebankNodeChildrenToIndexes(node, jCas, tokenAnns, tree)); node.setLeaf(node.getChildren().size() == 0); node.addToIndexes(); }
uimaNode.setNodeTags(nodeTags); uimaNode.setNodeValue(pojoNode.getValue()); uimaNode.setLeaf(pojoNode.isLeaf()); uimaNode.setParent(parentNode);
uimaNode.setNodeTags(nodeTags); uimaNode.setNodeValue(pojoNode.getValue()); uimaNode.setLeaf(pojoNode.isLeaf()); uimaNode.setParent(parentNode);