public static String printCoreferenceView(CoreferenceView cView) { StringBuilder bldr = new StringBuilder(); StringBuilder chainBuilder = new StringBuilder(); Set<Constituent> canons = cView.getCanonicalEntitiesViaRelations(); for (Constituent c : canons) { Set<Constituent> mentions = cView.getCoreferentMentionsViaRelations(c); bldr.append("Canonical Mention:\n").append(printConstituent(c)); chainBuilder.append("** ").append(c.getSurfaceForm()).append(" **: "); bldr.append("\nChain:\n"); int i = 1; for (Constituent m : mentions) { bldr.append("\n").append(i++).append(": ").append(printConstituent(m)); chainBuilder.append("[").append(m.getSurfaceForm()).append("] "); } bldr.append(SMALL_SEPARATOR); chainBuilder.append("\n"); } bldr.append("Chain forms: ").append(chainBuilder.toString()); return bldr.toString(); } }
public static String printCoreferenceView(CoreferenceView cView) { StringBuilder bldr = new StringBuilder(); StringBuilder chainBuilder = new StringBuilder(); Set<Constituent> canons = cView.getCanonicalEntitiesViaRelations(); for (Constituent c : canons) { Set<Constituent> mentions = cView.getCoreferentMentionsViaRelations(c); bldr.append("Canonical Mention:\n").append(printConstituent(c)); chainBuilder.append("** ").append(c.getSurfaceForm()).append(" **: "); bldr.append("\nChain:\n"); int i = 1; for (Constituent m : mentions) { bldr.append("\n").append(i++).append(": ").append(printConstituent(m)); chainBuilder.append("[").append(m.getSurfaceForm()).append("] "); } bldr.append(SMALL_SEPARATOR); chainBuilder.append("\n"); } bldr.append("Chain forms: ").append(chainBuilder.toString()); return bldr.toString(); } }
for (Constituent goldCanonicalCons : gold.getCanonicalEntitiesViaRelations()) { HashSet<Constituent> consInGoldCluster = new HashSet(gold.getCoreferentMentionsViaRelations(goldCanonicalCons)); for (Constituent predCanonicalCons : prediction.getCanonicalEntitiesViaRelations()) { HashSet<Constituent> consInPredCluster = new HashSet(prediction.getCoreferentMentionsViaRelations(predCanonicalCons)); Set<Constituent> intersection = new HashSet(); for(Constituent cGold : consInGoldCluster) { for (Constituent predCanonicalCons : prediction.getCanonicalEntitiesViaRelations()) { HashSet<Constituent> consInPredCluster = new HashSet(prediction.getCoreferentMentionsViaRelations(predCanonicalCons)); for (Constituent goldCanonicalCons : gold.getCanonicalEntitiesViaRelations()) { HashSet<Constituent> consInGoldCluster = new HashSet(gold.getCoreferentMentionsViaRelations(goldCanonicalCons)); Set<Constituent> intersection = new HashSet(); for(Constituent cPred: consInPredCluster) {
for (Constituent goldCanonicalCons : gold.getCanonicalEntitiesViaRelations()) { HashSet<Constituent> consInGoldCluster = new HashSet(gold.getCoreferentMentionsViaRelations(goldCanonicalCons)); for (Constituent predCanonicalCons : prediction.getCanonicalEntitiesViaRelations()) { HashSet<Constituent> consInPredCluster = new HashSet(prediction.getCoreferentMentionsViaRelations(predCanonicalCons)); Set<Constituent> intersection = new HashSet(); for(Constituent cGold : consInGoldCluster) { for (Constituent predCanonicalCons : prediction.getCanonicalEntitiesViaRelations()) { HashSet<Constituent> consInPredCluster = new HashSet(prediction.getCoreferentMentionsViaRelations(predCanonicalCons)); for (Constituent goldCanonicalCons : gold.getCanonicalEntitiesViaRelations()) { HashSet<Constituent> consInGoldCluster = new HashSet(gold.getCoreferentMentionsViaRelations(goldCanonicalCons)); Set<Constituent> intersection = new HashSet(); for(Constituent cPred: consInPredCluster) {
for (Constituent predCanonicalCons : overlappingPredCanonicalCons) { HashSet<Constituent> consInPredCluster = new HashSet(prediction.getCoreferentMentionsViaRelations(predCanonicalCons)); for (Constituent goldCanonicalCons : overlappingGoldCanonicalCons) { HashSet<Constituent> consInGoldCluster = new HashSet(gold.getCoreferentMentionsViaRelations(goldCanonicalCons));
for (Constituent predCanonicalCons : overlappingPredCanonicalCons) { HashSet<Constituent> consInPredCluster = new HashSet(prediction.getCoreferentMentionsViaRelations(predCanonicalCons)); for (Constituent goldCanonicalCons : overlappingGoldCanonicalCons) { HashSet<Constituent> consInGoldCluster = new HashSet(gold.getCoreferentMentionsViaRelations(goldCanonicalCons));
prediction.getOverlappingChainsCanonicalMentions(cons1); for (Constituent c : coreferents1gold) coreferents1gold.addAll(gold.getCoreferentMentionsViaRelations(c)); for (Constituent c : coreferents1gold) coreferents1pred.addAll(prediction.getCoreferentMentionsViaRelations(c));
prediction.getOverlappingChainsCanonicalMentions(cons1); for (Constituent c : coreferents1gold) coreferents1gold.addAll(gold.getCoreferentMentionsViaRelations(c)); for (Constituent c : coreferents1gold) coreferents1pred.addAll(prediction.getCoreferentMentionsViaRelations(c));