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 Meka2Trec method main.
/**
* this is only support multi-label classification dataset.
* @param args
*/
public static void main(String[] args) throws IOException {
if (args.length != 1) {
throw new IllegalArgumentException("Please specify a properties file.");
}
Config config = new Config(args[0]);
System.out.println(config);
List<String> trecs = config.getStrings("trec");
List<String> mekas = config.getStrings("meka");
int numLabels = config.getInt("numLabels");
int numFeatures = config.getInt("numFeatures");
String dataMode = config.getString("dataMode");
for (int i = 0; i < mekas.size(); i++) {
System.out.println("processing on: " + trecs.get(i));
MultiLabelClfDataSet dataSet = MekaFormat.loadMLClfDataset(mekas.get(i), numFeatures, numLabels, dataMode);
TRECFormat.save(dataSet, trecs.get(i));
}
}
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 TRECFormat method parseNumDataPoints.
//==========PRIVATE==========
private static int parseNumDataPoints(File trecFile) throws IOException {
File configFile = new File(trecFile, TREC_CONFIG_FILE_NAME);
int numDataPoints;
try (BufferedReader br = new BufferedReader(new FileReader(configFile))) {
Config config = new Config(configFile);
numDataPoints = config.getInt(TREC_CONFIG_NUM_DATA_POINTS);
}
return numDataPoints;
}
Aggregations