16 package uk.ac.cam.eng.extraction.hadoop.features.phrase;
18 import java.io.IOException;
20 import org.apache.hadoop.conf.Configuration;
21 import org.apache.hadoop.conf.Configured;
22 import org.apache.hadoop.fs.Path;
23 import org.apache.hadoop.mapreduce.Job;
24 import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
25 import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
26 import org.apache.hadoop.util.Tool;
31 import com.beust.jcommander.ParameterException;
39 public abstract class PhraseJob extends Configured implements Tool {
41 public abstract Job
getJob(Configuration conf)
throws IOException;
44 public int run(String[] args)
throws IllegalArgumentException,
45 IllegalAccessException, IOException, ClassNotFoundException,
46 InterruptedException {
50 }
catch (ParameterException e) {
53 Configuration conf = getConf();
56 FileInputFormat.setInputPaths(job, params.input);
57 FileOutputFormat.setOutputPath(job,
new Path(params.output));
58 return job.waitForCompletion(
true) ? 0 : 1;