use of edu.cmu.ml.proppr.util.multithreading.Multithreading in project ProPPR by TeamCohen.
the class Grounder method groundExamples.
public void groundExamples(File dataFile, File groundedFile, boolean maintainOrder) {
status.start();
try {
if (this.graphKeyFile != null)
this.graphKeyWriter = new BufferedWriter(new FileWriter(this.graphKeyFile));
this.statistics = new GroundingStatistics();
this.empty = 0;
Multithreading<InferenceExample, String> m = new Multithreading<InferenceExample, String>(log, this.status, maintainOrder);
m.executeJob(this.nthreads, new InferenceExampleStreamer(dataFile).stream(), new Transformer<InferenceExample, String>() {
@Override
public Callable<String> transformer(InferenceExample in, int id) {
return new Ground(in, id);
}
}, groundedFile, this.throttle);
reportStatistics(empty);
File indexFile = new File(groundedFile.getParent(), groundedFile.getName() + FEATURE_INDEX_EXTENSION);
serializeFeatures(indexFile, featureTable);
if (this.graphKeyFile != null)
this.graphKeyWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations