private EdgeInfo fromStringEdgeInfo(String str) { return new DefaultEdgeInfo(new DependencyRelation(str, null)); }
relation = node.getInfo().getEdgeInfo().getDependencyRelation().getStringRepresentation(); sbRelations.append(relation); sbPosRelations.append(">" + relation + ">" + pos);
relation = node.getInfo().getEdgeInfo().getDependencyRelation().getStringRepresentation(); sbRelations.append(relation); sbPosRelations.append(">" + relation + ">" + pos);
private EdgeInfo emptyEdgeInfo() { return new DefaultEdgeInfo(new DependencyRelation("", null)); }
String relationName = node.getInfo().getEdgeInfo().getDependencyRelation().getStringRepresentation(); String relationName = node.getInfo().getEdgeInfo().getDependencyRelation().getStringRepresentation(); processDependency(jcas, dependencyChildToken, dependencyParentNode, relationName, tokenAnnotations, sentenceAnno);
private static EdgeInfo buildEdgeInfo(JCas jcas, String dependencyType) { DependencyRelation relation = null; if (dependencyType != null) { relation = new DependencyRelation(dependencyType, null); } return new DefaultEdgeInfo(relation); }
/** * for tracing. */ private static String outNode(BasicNode node) { String result = String.format("id=%s:ser=%d:%s:%s", node.getInfo().getId(), node.getInfo().getNodeInfo().getSerial(), node.getInfo().getNodeInfo().getWord(), node.getInfo().getEdgeInfo().getDependencyRelation()!=null?node.getInfo().getEdgeInfo().getDependencyRelation().getStringRepresentation():"null"); if (node.getAntecedent() != null) { result += String.format("(^%s)", outNode(node.getAntecedent())); } return result; }
/** * @param relation * @param object * @return * @throws CompilationException */ public static DependencyRelation newDependencyRelation(String relation) throws CompilationException { if (relation.equals(ExtendedMatchCriteria.WILDCARD_RELATION)) // accept the wildcard return new DependencyRelation(ExtendedMatchCriteria.WILDCARD_RELATION, null); try { return new StanfordDependencyRelation(relation); } catch (StanfordDependencyException e) { throw new CompilationException("see nested", e); } } }
LemmaPosTextUnit parent = new LemmaPosTextUnit(parentNode.getInfo().getNodeInfo().getWordLemma(),parentNode.getInfo().getNodeInfo().getSyntacticInfo().getPartOfSpeech().getCanonicalPosTag()); Relation<String> rel = new DefaultRelation<String>(childNode.getInfo().getEdgeInfo().getDependencyRelation().getStringRepresentation()); textUnints.add(parent); textUnints.add(child);
private void copyEntities() { CopyDepthLimitedTree copier1 = new CopyDepthLimitedTree(entity1, new DefaultEdgeInfo(new DependencyRelation("nsubj", DependencyRelationType.SUBJECT))); copier1.copy(Constants.DEFAULT_COPY_SUBTREE_DEPTH); entity1 = copier1.getGeneratedTree(); DsUtils.BidiMapAddAll(bidiMapOriginalToGenerated, copier1.getMapOriginalToGenerated()); CopyDepthLimitedTree copier2 = new CopyDepthLimitedTree(entity2, new DefaultEdgeInfo(new DependencyRelation("", null))); copier2.copy(Constants.DEFAULT_COPY_SUBTREE_DEPTH); entity2 = copier2.getGeneratedTree(); DsUtils.BidiMapAddAll(bidiMapOriginalToGenerated, copier2.getMapOriginalToGenerated()); }
protected BasicNode getBasicNodeFromConll(String[] toks) throws Exception { /* * items[0]: ID * items[1]: word form * items[2]: lemma * items[4]: POS * items[6]: head ID * items[7]: dependency label */ if (toks.length < 8) throw new Exception("Number of columns for each word should be at least 8: " + toks); String lemma = toks[2]; if (lemma.equals(UNKNOWN)) lemma = toks[1]; NodeInfo nodeInfo = new DefaultNodeInfo(toks[1],lemma,Integer.parseInt(toks[0]),null, new DefaultSyntacticInfo(pos.createNewPartOfSpeech(toks[4]))); EdgeInfo edgeInfo = new DefaultEdgeInfo(new DependencyRelation(toks[7],null)); Info info = new DefaultInfo(null,nodeInfo,edgeInfo); return new BasicNode(info); }
relation = new DependencyRelation(label, mapRelation.get(label)); relation = new DependencyRelation(label, null);
/** * Ctor * @throws EntailmentCompilationException */ private DefaultEntailmentRuleCompileServices() throws EntailmentCompilationException { try { PERIOD_NODE = new BasicNode(new DefaultInfo("", new DefaultNodeInfo(PERIOD, PERIOD, -1, null, new DefaultSyntacticInfo(new BySimplerCanonicalPartOfSpeech(SimplerCanonicalPosTag.PUNCTUATION))), new DefaultEdgeInfo(new DependencyRelation(StanfordDepedencyRelationType.punct.name(), null)))); } catch (UnsupportedPosTagStringException e) { throw new EntailmentCompilationException("Internal bug! could not instantiate a new UnspecifiedPartOfSpeech(SimplerCanonicalPosTag.PUNCTUATION)", e); } }
throw new ParserRunException("empty output"); BasicNode root = new BasicNode(new DefaultInfo("0",new DefaultNodeInfo("ROOT", "ROOT", 0, null, new DefaultSyntacticInfo(new StuttgartTreeTaggerPartOfSpeech("ROOT"))),new DefaultEdgeInfo(new DependencyRelation("ROOT", null)))); mapIdToNode.put(0, root); new BasicNode(new DefaultInfo(serial,new DefaultNodeInfo(lemma, lemma, id, null, new DefaultSyntacticInfo(new StuttgartTreeTaggerPartOfSpeech(pos))),new DefaultEdgeInfo(new DependencyRelation(relation, null)))); mapIdToNode.put(id, node); int parentId = Integer.parseInt(parent);
public void construct() throws UnsupportedPosTagStringException { bidiMapOriginalToGenerated = new SimpleBidirectionalMap<ExtendedNode, ExtendedNode>(); affectedNodes = new LinkedHashSet<ExtendedNode>(); copyEntities(); entity2.addChild(entity1); ExtendedNode beNode = new ExtendedNode(new ExtendedInfo( new DefaultInfo("IS_A_be", new DefaultNodeInfo("be", "be", 0, null, new DefaultSyntacticInfo(new PennPartOfSpeech(PennPosTag.VBZ))), new DefaultEdgeInfo(new DependencyRelation("cop", null))), AdditionalInformationServices.emptyInformation())); entity2.addChild(beNode); ExtendedNode punctNode = new ExtendedNode(new ExtendedInfo( new DefaultInfo("IS_A_punct", new DefaultNodeInfo(".", ".", 0, null, new DefaultSyntacticInfo(new PennPartOfSpeech("."))), new DefaultEdgeInfo(new DependencyRelation("punct", null))), AdditionalInformationServices.emptyInformation())); entity2.addChild(punctNode); generatedTree = entity2; affectedNodes.add(beNode); affectedNodes.add(punctNode); affectedNodes.add(entity1); affectedNodes.add(entity2); }
BasicNode child = new BasicNode(new DefaultInfo(DEFAULT_ID, rpNodeInfo, new DefaultEdgeInfo(new DependencyRelation("prt", null)))); ret.addChild(child); BasicNode child = new BasicNode(new DefaultInfo(DEFAULT_ID, childNodeInfo, new DefaultEdgeInfo(new DependencyRelation("nn", null)))); ret.addChild(child);
edgeInfo = new DefaultEdgeInfo(new DependencyRelation(relation, null));
if (0==index) EdgeInfo childEdgeInfo = new DefaultEdgeInfo(new DependencyRelation(DEFAULT_RELATION_TO_PREP, null)); if (!isNode(leftPart[index])) childRelation = DEFAULT_RELATION; childEdgeInfo = new DefaultEdgeInfo(new DependencyRelation(childRelation, null));
EdgeInfo edgeInfoForChild = new DefaultEdgeInfo(new DependencyRelation(DEFAULT_RELATION_TO_PREP, null)); if (!isNode(rightPart[index])) else childRelation = DEFAULT_RELATION; edgeInfoForChild = new DefaultEdgeInfo(new DependencyRelation(childRelation, null));
new DefaultEdgeInfo(new DependencyRelation("", null))));