use of org.kohsuke.args4j.CmdLineParser in project Anserini by castorini.
the class LookupObjectTriples method main.
public static void main(String[] args) throws Exception {
Args searchArgs = new Args();
// Parse args
CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
System.err.println("Example command: " + LookupObjectTriples.class.getSimpleName() + parser.printExample(OptionHandlerFilter.REQUIRED));
return;
}
new LookupObjectTriples(searchArgs.index).search(searchArgs.subject, searchArgs.predicate);
}
use of org.kohsuke.args4j.CmdLineParser in project Anserini by castorini.
the class TrainingDataGenerator method main.
public static void main(String[] args) throws Exception {
Args trainingDataGeneratorArgs = new Args();
CmdLineParser parser = new CmdLineParser(trainingDataGeneratorArgs, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
System.err.println("Example command: " + TrainingDataGenerator.class.getSimpleName() + parser.printExample(OptionHandlerFilter.REQUIRED));
return;
}
LOG.info("Generating training data started...");
new TrainingDataGenerator(trainingDataGeneratorArgs).generateTrainingData();
LOG.info("Generating training data completed.");
}
use of org.kohsuke.args4j.CmdLineParser in project Anserini by castorini.
the class JsonStatusCorpusReader method main.
public static void main(String[] argv) throws IOException {
Args args = new Args();
CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(100));
try {
parser.parseArgument(argv);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
System.exit(-1);
}
long minId = Long.MAX_VALUE, maxId = Long.MIN_VALUE, cnt = 0;
JsonStatusCorpusReader tweets = new JsonStatusCorpusReader(new File(args.input));
Status tweet = null;
while ((tweet = tweets.next()) != null) {
cnt++;
long id = tweet.getId();
System.out.println("id: " + id);
if (id < minId)
minId = id;
if (id > maxId)
maxId = id;
if (cnt % 100000 == 0) {
System.out.println("Read " + cnt + " tweets");
}
}
tweets.close();
System.out.println("Read " + cnt + " in total.");
System.out.println("MaxId = " + maxId);
System.out.println("MinId = " + minId);
}
use of org.kohsuke.args4j.CmdLineParser in project Anserini by castorini.
the class JsonTweetsCollection method main.
public static void main(String[] argv) throws IOException {
Args args = new Args();
CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(100));
try {
parser.parseArgument(argv);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
System.exit(-1);
}
long minId = Long.MAX_VALUE, maxId = Long.MIN_VALUE, cnt = 0;
JsonTweetsCollection tweets = new JsonTweetsCollection(new File(args.input));
for (Status tweet : tweets) {
cnt++;
long id = tweet.getId();
System.out.println("id: " + id);
if (id < minId)
minId = id;
if (id > maxId)
maxId = id;
if (cnt % 100000 == 0) {
System.out.println("Read " + cnt + " tweets");
}
}
tweets.close();
System.out.println("Read " + cnt + " in total.");
System.out.println("MaxId = " + maxId);
System.out.println("MinId = " + minId);
}
use of org.kohsuke.args4j.CmdLineParser in project Anserini by castorini.
the class Eval method main.
public static void main(String[] args) throws Exception {
EvalArgs evalArgs = new EvalArgs();
CmdLineParser parser = new CmdLineParser(evalArgs, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
parser.printUsage(System.err);
System.err.println("Example: Eval " + parser.printExample(OptionHandlerFilter.REQUIRED));
return;
}
allMetrics = evalArgs.reqMetrics == null ? defaultMetrics : evalArgs.reqMetrics;
if (allMetrics.length == 0) {
System.err.println("No metric provided...exit");
return;
}
eval(evalArgs.runPath, evalArgs.qrelPath);
print(evalArgs.printPerQuery, System.out);
}
Aggregations