}
ParserEventTypeEnum etype = null;
boolean fun = false;
int ai = 0;
Dictionary dict = null;
AbstractModel model = null;
while (ai < args.length && args[ai].startsWith("-")) {
if (args[ai].equals("-build")) {
etype = ParserEventTypeEnum.BUILD;
}
else if (args[ai].equals("-attach")) {
etype = ParserEventTypeEnum.ATTACH;
}
else if (args[ai].equals("-chunk")) {
etype = ParserEventTypeEnum.CHUNK;
}
else if (args[ai].equals("-check")) {
etype = ParserEventTypeEnum.CHECK;
}
else if (args[ai].equals("-tag")) {
etype = ParserEventTypeEnum.TAG;
}
else if (args[ai].equals("-fun")) {
fun = true;
}
else if (args[ai].equals("-dict")) {
ai++;
dict = new Dictionary(new FileInputStream(args[ai]));
}
else if (args[ai].equals("-model")) {
ai++;
model = (new SuffixSensitiveGISModelReader(new File(args[ai]))).getModel();
}
else {
System.err.println("Invalid option " + args[ai]);
System.exit(1);
}
ai++;
}
HeadRules rules = new opennlp.tools.parser.lang.en.HeadRules(args[ai++]);
if (fun) {
Parse.useFunctionTags(true);
}
ObjectStream<Event> es = new ParserEventStream(new ParseSampleStream(new PlainTextByLineStream(new java.io.InputStreamReader(System.in))), rules, etype, dict);
Event e;
while ((e = es.read()) != null) {
if (model != null) {
System.out.print(model.eval(e.getContext())[model.getIndex(e.getOutcome())]+" ");
}
System.out.println(e);
}
}