Joshua
open source statistical hierarchical phrase-based machine translation system
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
joshua.subsample.SubsamplerCLI Class Reference
Collaboration diagram for joshua.subsample.SubsamplerCLI:
[legend]

List of all members.

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

Detailed Description

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.

Author:
wren ng thornton wren@.nosp@m.user.nosp@m.s.sou.nosp@m.rcef.nosp@m.orge..nosp@m.net
Version:
$LastChangedDate$

Member Function Documentation

This method should be overridden to return the class used in runSubsampler.

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.

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

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.

Here is the call graph for this function:


Member Data Documentation

final Option joshua.subsample.SubsamplerCLI.oe [protected]
Initial value:
 OptionBuilder.withArgName("lang").hasArg()
      .withDescription("Native language extension").isRequired().create("e")
final Option joshua.subsample.SubsamplerCLI.oepath [protected]
Initial value:
 OptionBuilder.withArgName("path").hasArg()
      .withDescription("Directory containing native language files").create("epath")
final Option joshua.subsample.SubsamplerCLI.of [protected]
Initial value:
 OptionBuilder.withArgName("lang").hasArg()
      .withDescription("Foreign language extension").isRequired().create("f")
final Option joshua.subsample.SubsamplerCLI.ofpath [protected]
Initial value:
 OptionBuilder.withArgName("path").hasArg()
      .withDescription("Directory containing foreign language files").create("fpath")
final Option joshua.subsample.SubsamplerCLI.ooutput [protected]
Initial value:
 OptionBuilder.withArgName("basename").hasArgs()
      .withDescription("File basename for output training corpus").isRequired().create("output")
final Option joshua.subsample.SubsamplerCLI.oratio [protected]
Initial value:
 OptionBuilder.withArgName("ratio").hasArg()
      .withDescription("Target F/E ratio").create("ratio")
final Option joshua.subsample.SubsamplerCLI.ot [protected]
Initial value:
 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]
Initial value:
 OptionBuilder.withArgName("file").hasArgs()
      .withDescription("The test file (what to sample for)").isRequired().create("test")