|
Joshua
open source statistical hierarchical phrase-based machine translation system
|
Public Member Functions | |
| Options | getCliOptions () |
| String | getClassName () |
| void | runSubsampler (String[] testFiles, int maxN, int targetCount, float ratio) throws IOException |
| void | runMain (String[] args) |
Protected Attributes | |
| final Option | ot |
| final Option | otest |
| final Option | ooutput |
| final Option | of |
| final Option | oe |
| final Option | ofpath |
| final Option | oepath |
| final Option | oratio |
This class defines a callback closure to allow "overriding" the main function in subclasses of Subsampler, without duplicating code. For all subclasses, CLI Options should be members of the class (so they're visible to runSubsampler as well as getCliOptions), the getCliOptions method should be overridden to add the additional options (via super to keep the old options), and the runSubsampler method should be overridden to do the primary work for main. The runMain method ties everything together and should not need modification. Due to the one-use nature of subclasses of SubsampleCLI, they generally should be implemented as anonymous local classes.
| String joshua.subsample.SubsamplerCLI.getClassName | ( | ) |
This method should be overridden to return the class used in runSubsampler.
| Options joshua.subsample.SubsamplerCLI.getCliOptions | ( | ) |
Return all Options. The HelpFormatter will print them in sorted order, so it doesn't matter when we add them. Subclasses should override this method by adding more options.
| void joshua.subsample.SubsamplerCLI.runMain | ( | String[] | args | ) |
Non-static version of main so that we can define anonymous local classes to override or extend the above.
| void joshua.subsample.SubsamplerCLI.runSubsampler | ( | String[] | testFiles, |
| int | maxN, | ||
| int | targetCount, | ||
| float | ratio | ||
| ) | throws IOException |
Callback to run the subsampler. This function needs access to the variables holding each Option, thus all this closure nonsense.
final Option joshua.subsample.SubsamplerCLI.oe [protected] |
OptionBuilder.withArgName("lang").hasArg() .withDescription("Native language extension").isRequired().create("e")
final Option joshua.subsample.SubsamplerCLI.oepath [protected] |
OptionBuilder.withArgName("path").hasArg() .withDescription("Directory containing native language files").create("epath")
final Option joshua.subsample.SubsamplerCLI.of [protected] |
OptionBuilder.withArgName("lang").hasArg() .withDescription("Foreign language extension").isRequired().create("f")
final Option joshua.subsample.SubsamplerCLI.ofpath [protected] |
OptionBuilder.withArgName("path").hasArg() .withDescription("Directory containing foreign language files").create("fpath")
final Option joshua.subsample.SubsamplerCLI.ooutput [protected] |
OptionBuilder.withArgName("basename").hasArgs() .withDescription("File basename for output training corpus").isRequired().create("output")
final Option joshua.subsample.SubsamplerCLI.oratio [protected] |
OptionBuilder.withArgName("ratio").hasArg() .withDescription("Target F/E ratio").create("ratio")
final Option joshua.subsample.SubsamplerCLI.ot [protected] |
OptionBuilder.withArgName("listfile").hasArg() .withDescription("A file containing a list of training file basenames (what to sample from)") .isRequired().create("training")
final Option joshua.subsample.SubsamplerCLI.otest [protected] |
OptionBuilder.withArgName("file").hasArgs() .withDescription("The test file (what to sample for)").isRequired().create("test")