@Override public DependencyRelation createRelation(JCas jCas, DependencyNode head, DependencyNode child, String relation) { DependencyRelation rel = new DependencyRelation(jCas); rel.setChild(child); rel.setHead(head); rel.setRelation(relation); return rel; }
@Override public DependencyNode getHead(JCas jCas, DependencyRelation relation) { return relation.getHead(); }
@Override public String getLabel(JCas jCas, DependencyRelation relation) { return relation.getRelation(); }
DependencyNode node; if (maltNode.getHead().getIndex() != 0) { node = new DependencyNode(jCas, token.getBegin(), token.getEnd()); } else { node = new TopDependencyNode(jCas, token.getBegin(), token.getEnd()); DependencyNode node = nodes.get(i); DependencyNode head = nodes.get(headIndex); DependencyRelation rel = new DependencyRelation(jCas); rel.setHead(head); rel.setChild(node); rel.setRelation(label); rel.addToIndexes(); if (!headRelations.containsKey(node)) { headRelations.put(node, new ArrayList<DependencyRelation>()); node.setHeadRelations(new FSArray(jCas, heads == null ? 0 : heads.size())); if (heads != null) { FSCollectionFactory.fillArrayFS(node.getHeadRelations(), heads); node.setChildRelations(new FSArray(jCas, children == null ? 0 : children.size())); if (children != null) { FSCollectionFactory.fillArrayFS(node.getChildRelations(), children); node.addToIndexes();
@Override public void setHeadRelations( JCas jCas, DependencyNode node, List<DependencyRelation> headRelations) { node.setHeadRelations(new FSArray(jCas, headRelations.size())); FSCollectionFactory.fillArrayFS(node.getHeadRelations(), headRelations); }
@Override public void setChildRelations( JCas jCas, DependencyNode node, List<DependencyRelation> childRelations) { node.setChildRelations(new FSArray(jCas, childRelations.size())); FSCollectionFactory.fillArrayFS(node.getChildRelations(), childRelations); }
@Override public List<DependencyRelation> getHeadRelations(JCas jCas, DependencyNode node) { return Lists.newArrayList(JCasUtil.select(node.getHeadRelations(), DependencyRelation.class)); }
@Override public TopDependencyNode createRootNode(JCas jCas, Sentence sentence) { return new TopDependencyNode(jCas, sentence.getBegin(), sentence.getEnd()); }
@Override public DependencyNode createNode(JCas jCas, Token token) { return new DependencyNode(jCas, token.getBegin(), token.getEnd()); }
DependencyNode node; if (dependencies.getRoots().contains(stanfordNode)) { node = new TopDependencyNode(jCas, tokenBegin, tokenEnd); } else { node = new DependencyNode(jCas, tokenBegin, tokenEnd); ArrayListMultimap<DependencyNode, DependencyRelation> childRelations = ArrayListMultimap.create(); for (SemanticGraphEdge stanfordEdge : dependencies.edgeIterable()) { DependencyRelation relation = new DependencyRelation(jCas); DependencyNode head = stanfordToUima.get(stanfordEdge.getGovernor()); DependencyNode child = stanfordToUima.get(stanfordEdge.getDependent()); relation.setHead(head); relation.setChild(child); relation.setRelation(relationType); relation.addToIndexes(); headRelations.put(child, relation); childRelations.put(head, relation); node.setHeadRelations(new FSArray(jCas, heads == null ? 0 : heads.size())); if (heads != null) { FSCollectionFactory.fillArrayFS(node.getHeadRelations(), heads); node.setChildRelations(new FSArray(jCas, children == null ? 0 : children.size())); if (children != null) { FSCollectionFactory.fillArrayFS(node.getChildRelations(), children); node.addToIndexes();