/** * Given a constituent, it returns the canonical constituents which represents the cluster. */ public Set<Constituent> getCanonicalEntitySetViaRelation(Constituent c) { List<Relation> incomingRelations = getFilteredIncomingRelations(c); // The assumption is that all nodes with no parent are canonical entities. if (incomingRelations.isEmpty()) return new HashSet(Arrays.asList(c)); Set<Constituent> canonical = new HashSet<>(); for (Relation r : incomingRelations) canonical.add(r.source); return canonical; }
/** * Given a constituent, it returns the canonical constituents which represents the cluster. */ public Set<Constituent> getCanonicalEntitySetViaRelation(Constituent c) { List<Relation> incomingRelations = getFilteredIncomingRelations(c); // The assumption is that all nodes with no parent are canonical entities. if (incomingRelations.isEmpty()) return new HashSet(Arrays.asList(c)); Set<Constituent> canonical = new HashSet<>(); for (Relation r : incomingRelations) canonical.add(r.source); return canonical; }
/** * Given a constituent, it returns the canonical constituent which represents the cluster. */ public Constituent getCanonicalEntityViaRelation(Constituent c) { List<Relation> incomingRelations = getFilteredIncomingRelations(c); // The assumption is that all nodes with no parent are canonical entities. if (incomingRelations.isEmpty()) return c; if (incomingRelations.size() > 1) logger.warn("Warning: constituent belongs to more than one cluster; we returned only one of them.\n" + "If you are deadline with overlapping clusters, and want to get all of the canonical elements, " + "\"getCanonicalEntitySetViaRelation\" function. "); return incomingRelations.get(0).source; }
/** * Given a constituent, it returns the canonical constituent which represents the cluster. */ public Constituent getCanonicalEntityViaRelation(Constituent c) { List<Relation> incomingRelations = getFilteredIncomingRelations(c); // The assumption is that all nodes with no parent are canonical entities. if (incomingRelations.isEmpty()) return c; if (incomingRelations.size() > 1) logger.warn("Warning: constituent belongs to more than one cluster; we returned only one of them.\n" + "If you are deadline with overlapping clusters, and want to get all of the canonical elements, " + "\"getCanonicalEntitySetViaRelation\" function. "); return incomingRelations.get(0).source; }
/** * Finds the representative elements for each cluster */ @Deprecated private void findCanonicalEntries() { if (this.canonicalEntitiesMap.size() > 0 || !this.modified) return; // The assumption is that all nodes with no parent are canonical entities. for (Constituent cc : this.getConstituents()) { int ccId = this.constituents.indexOf(cc); if (getFilteredIncomingRelations(cc).size() == 0) { canonicalEntitiesMap.put(ccId, ccId); for (Relation r : getFilteredOutgoingRelations(cc)) { int tId = this.constituents.indexOf(r.getTarget()); canonicalEntitiesMap.put(tId, ccId); } } } modified = false; }
/** * Finds the representative elements for each cluster */ @Deprecated private void findCanonicalEntries() { if (this.canonicalEntitiesMap.size() > 0 || !this.modified) return; // The assumption is that all nodes with no parent are canonical entities. for (Constituent cc : this.getConstituents()) { int ccId = this.constituents.indexOf(cc); if (getFilteredIncomingRelations(cc).size() == 0) { canonicalEntitiesMap.put(ccId, ccId); for (Relation r : getFilteredOutgoingRelations(cc)) { int tId = this.constituents.indexOf(r.getTarget()); canonicalEntitiesMap.put(tId, ccId); } } } modified = false; }