if (args.length != 1) {
System.out.println(getHelp());
}
else {
TreebankLinker treebankLinker;
try {
treebankLinker = new TreebankLinker(args[0], LinkerMode.TEST);
} catch (IOException e) {
throw new TerminateToolException(-1, "Failed to load all coreferencer models!", e);
}
ObjectStream<String> lineStream =
new PlainTextByLineStream(new InputStreamReader(System.in));
PerformanceMonitor perfMon = new PerformanceMonitor(System.err, "parses");
perfMon.start();
try {
int sentenceNumber = 0;
List<Mention> document = new ArrayList<Mention>();
List<Parse> parses = new ArrayList<Parse>();
String line;
while ((line = lineStream.read()) != null) {
if (line.equals("")) {
DiscourseEntity[] entities = treebankLinker.getEntities(document.toArray(new Mention[document.size()]));
//showEntities(entities);
new CorefParse(parses,entities).show();
sentenceNumber=0;
document.clear();
parses.clear();
}
else {
Parse p = Parse.parseParse(line);
parses.add(p);
Mention[] extents = treebankLinker.getMentionFinder().getMentions(new DefaultParse(p,sentenceNumber));
//construct new parses for mentions which don't have constituents.
for (int ei=0,en=extents.length;ei<en;ei++) {
//System.err.println("PennTreebankLiner.main: "+ei+" "+extents[ei]);
if (extents[ei].getParse() == null) {