private static EdgeInfo buildEdgeInfo(JCas jcas, String dependencyType) { DependencyRelation relation = null; if (dependencyType != null) { relation = new DependencyRelation(dependencyType, null); } return new DefaultEdgeInfo(relation); }
public static boolean infoIsNamedEntity(Info info) { boolean ret = false; if (info!=null){if(info.getNodeInfo()!=null){if(info.getNodeInfo().getNamedEntityAnnotation()!=null) { ret = true; }}} return ret; }
public Info newInfoRTT(Info nodeInfo, Info edgeInfo, Info additionalInformation) { return new DefaultInfo(nodeInfo.getId(), nodeInfo.getNodeInfo(), edgeInfo.getEdgeInfo()); }
/** * 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); } }
public static BasicNode addArtificialRoot(BasicNode tree) { DefaultInfo rootInfo = new DefaultInfo(AbstractBasicParser.ROOT_NODE_ID,new DefaultNodeInfo(null,null,0,null,new DefaultSyntacticInfo(null)),new DefaultEdgeInfo(null)); BasicNode root = new BasicNode(rootInfo); root.addChild(tree); return root; } }
public ExtendedInfo(Info info, AdditionalNodeInformation additionalNodeInformation) { super(info.getId(), info.getNodeInfo(), info.getEdgeInfo()); this.additionalNodeInformation = additionalNodeInformation; }
@Override public String toString() { return "ExtendedInfo [nodeInfo=" + InfoGetFields.getLemma(nodeInfo) + "/" + InfoGetFields.getPartOfSpeech(nodeInfo) + ", edgeInfo=" + InfoGetFields.getRelation(edgeInfo) + ", id=" + id + ", additionalNodeInformation=" + additionalNodeInformation + "]"; }
public static ExtendedNode createNodeOfArtificialRoot() { ExtendedInfo rootInfo = new ExtendedInfo(AbstractBasicParser.ROOT_NODE_ID,new DefaultNodeInfo(null,null,0,null,new DefaultSyntacticInfo(null)),new DefaultEdgeInfo(null),ExtendedNodeConstructor.EMPTY_ADDITIONAL_NODE_INFORMATION); ExtendedNode root = new ExtendedNode(rootInfo); return root; }
public boolean edgesMatch(ExtendedInfo mainInfo, ExtendedInfo testInfo) { if (InfoGetFields.getRelation(testInfo).equals(ExtendedMatchCriteria.WILDCARD_RELATION)) return true; // wildcard in the rule! return defaultMatchCriteria.edgesMatch(mainInfo, testInfo); }
@Override public int compare(BasicNode o1, BasicNode o2) { if (o1.getAntecedent() != null && o2.getAntecedent() == null) { return 1; } else if (o1.getAntecedent() == null && o2.getAntecedent() != null) { return -1; } else { return o1.getInfo().getNodeInfo().getSerial() - o2.getInfo().getNodeInfo().getSerial(); } }
/** * @param info an edge information (including dependency type) * @return a DIRT-like dependency path component for the given parse tree edge. * The component is made of the relation, for example: ">pobj>" or "<prep<". */ protected static String toDependencyPathComponent(EdgeInfo info, Direction arrowDirection) { String relation = InfoGetFields.getRelation(info); if (arrowDirection==Direction.RIGHT_TO_LEFT) return "<"+relation+"<"; else return ">"+relation+">"; } }
public boolean isVariableR(Info info) { return InfoGetFields.isVariable(info); }
public Info newInfoRT(Info nodeInfo, Info edgeInfo) { return new DefaultInfo(nodeInfo.getId(), nodeInfo.getNodeInfo(), edgeInfo.getEdgeInfo()); }
private EdgeInfo fromStringEdgeInfo(String str) { return new DefaultEdgeInfo(new DependencyRelation(str, null)); }
public boolean edgesMatch(ExtendedInfo mainInfo, ExtendedInfo testInfo) { if (InfoGetFields.getRelation(testInfo).equals(ExtendedMatchCriteria.WILDCARD_RELATION)) return true; // wildcard in the rule! return defaultMatchCriteria.edgesMatch(mainInfo, testInfo); }
public boolean isVariableT(Info info) { return InfoGetFields.isVariable(info); }
private EdgeInfo emptyEdgeInfo() { return new DefaultEdgeInfo(new DependencyRelation("", null)); }
public boolean edgesMatch(ExtendedInfo mainInfo, ExtendedInfo testInfo) { if (InfoGetFields.getRelation(testInfo).equals(ExtendedMatchCriteria.WILDCARD_RELATION)) return true; // wildcard in the rule! return defaultMatchCriteria.edgesMatch(mainInfo, testInfo); }
@Override public boolean edgesMatch(TM mainInfo, TT testInfo) { if (InfoGetFields.getRelation(testInfo).equals(WILDCARD_RELATION)) return true; // wildcard in the rule! return defaultMatchCriteria.edgesMatch(mainInfo, testInfo); }