public List<ClusteredMention> runCoreference(Document doc) { // --Overhead startTrack("Testing " + doc.id); // (variables) List<ClusteredMention> rtn = new ArrayList<ClusteredMention>(doc.getMentions().size()); List<Mention> mentions = doc.getMentions(); int singletons = 0; // --Run Classifier for (int i = 0; i < mentions.size(); i++) { // (variables) Mention onPrix = mentions.get(i); int coreferentWith = -1; // (get mention it is coreferent with) for (int j = i - 1; j >= 0; j--) { ClusteredMention cand = rtn.get(j); boolean coreferent = classifier.classOf( new RVFDatum<Boolean, Feature>(extractor.extractFeatures(Pair.make(onPrix, cand)))); if (coreferent) { coreferentWith = j; break; } } if (coreferentWith < 0) { singletons += 1; rtn.add(onPrix.markSingleton()); } else { // log("Mention " + onPrix + " coreferent with " + mentions.get(coreferentWith)); rtn.add(onPrix.markCoreferent(rtn.get(coreferentWith))); } } // log("" + singletons + " singletons"); // --Return endTrack("Testing " + doc.id); return rtn; }