use of edu.neu.ccs.pyramid.configuration.Config in project pyramid by cheng-li.
the class Regex method main.
public static void main(String[] args) {
if (args.length != 1) {
throw new IllegalArgumentException("Please specify a properties file.");
}
Config config = new Config(args[0]);
System.out.println(config);
boolean match = config.getString("string").matches(config.getString("regularExpression"));
if (match) {
System.out.println("match!");
} else {
System.out.println("not match!");
}
}
use of edu.neu.ccs.pyramid.configuration.Config in project pyramid by cheng-li.
the class IndexChecker method main.
public static void main(String[] args) throws Exception {
if (args.length != 1) {
throw new IllegalArgumentException("Please specify a properties file.");
}
Config config = new Config(args[0]);
System.out.println(config);
ESIndex index = loadIndex(config);
List<String> fields = config.getStrings("fieldsToCheck");
for (String field : fields) {
check(index, field);
}
for (String field : fields) {
checkEmpty(index, field);
}
index.close();
}
use of edu.neu.ccs.pyramid.configuration.Config in project pyramid by cheng-li.
the class MLTrec2LibSvm method main.
public static void main(String[] args) throws Exception {
Config config = new Config(args[0]);
System.out.println(config);
List<String> trecs = config.getStrings("trec");
List<String> libSVMs = config.getStrings("libSVM");
for (int i = 0; i < trecs.size(); i++) {
MultiLabelClfDataSet trecDataset = TRECFormat.loadMultiLabelClfDataSet(new File(trecs.get(i)), DataSetType.ML_CLF_SPARSE, false);
System.out.println(i + " -- Translating on trecs: " + trecs.get(i));
LibSvmFormat.save(trecDataset, libSVMs.get(i));
}
}
use of edu.neu.ccs.pyramid.configuration.Config in project pyramid by cheng-li.
the class ZeroOutFeatures method main.
public static void main(String[] args) throws Exception {
if (args.length != 1) {
throw new IllegalArgumentException("Please specify a properties file.");
}
Config config = new Config(args[0]);
MultiLabelClfDataSet dataSet = TRECFormat.loadMultiLabelClfDataSet(config.getString("inputData"), DataSetType.ML_CLF_SPARSE, true);
List<Integer> indices = parse(config.getString("featureIndices"));
System.out.println("features to zero out = " + indices);
for (int j : indices) {
List<Integer> nonZeros = new ArrayList<>();
for (Vector.Element nonZero : dataSet.getColumn(j).nonZeroes()) {
nonZeros.add(nonZero.index());
}
for (int i : nonZeros) {
dataSet.setFeatureValue(i, j, 0);
}
}
TRECFormat.save(dataSet, config.getString("outputData"));
}
use of edu.neu.ccs.pyramid.configuration.Config in project pyramid by cheng-li.
the class FeatureBinarizer method main.
public static void main(String[] args) throws Exception {
Config config = new Config(args[0]);
System.out.println(config);
List<String> inputs = config.getStrings("input.trecFolders");
List<String> outputs = config.getStrings("output.trecFolders");
if (inputs.size() != outputs.size()) {
throw new IllegalArgumentException("inputs.size()!=outputs.size()");
}
for (int i = 0; i < inputs.size(); i++) {
String input = inputs.get(i);
String output = outputs.get(i);
binarize(config, input, output);
}
}
Aggregations