|
4 | 4 | import jannopts.Configurator; |
5 | 5 |
|
6 | 6 | import java.io.IOException; |
| 7 | +import java.io.FileInputStream; |
| 8 | +import java.util.Properties; |
7 | 9 | import java.util.ArrayList; |
8 | 10 | import java.util.List; |
9 | 11 | import java.util.Map; |
@@ -68,21 +70,31 @@ static int initThreads(final List<Metric<?>> metrics, int threads) { |
68 | 70 | return threads; |
69 | 71 | } |
70 | 72 |
|
| 73 | + private static String loadVersion() throws IOException { |
| 74 | + Properties props = new Properties(); |
| 75 | + FileInputStream in = new FileInputStream("constants"); |
| 76 | + props.load(in); |
| 77 | + in.close(); |
| 78 | + String version = props.getProperty("version"); |
| 79 | + return version; |
| 80 | + } |
| 81 | + |
71 | 82 | public static void main(String[] args) throws ConfigurationException, IOException, |
72 | 83 | InterruptedException { |
73 | 84 |
|
| 85 | + String version = loadVersion(); |
| 86 | + System.err.println(String.format("MultEval V%s\n", version) + |
| 87 | + "By Jonathan Clark\n" + |
| 88 | + "Using Libraries: METEOR (Michael Denkowski) and TER (Matthew Snover)\n"); |
| 89 | + |
74 | 90 | if (args.length == 0 || !MODULES.keySet().contains(args[0])) { |
75 | 91 | System.err.println("Usage: program <module_name> <module_options>"); |
76 | 92 | System.err.println("Available modules: " + MODULES.keySet().toString()); |
77 | 93 | System.exit(1); |
78 | 94 | } else { |
79 | 95 | String moduleName = args[0]; |
80 | 96 | Module module = MODULES.get(moduleName); |
81 | | - // TODO: Load version from constants file |
82 | | - Configurator opts = |
83 | | - new Configurator().withProgramHeader( |
84 | | - "MultEval V0.5.0\nBy Jonathan Clark\nUsing Libraries: METEOR (Michael Denkowski) and TER (Matthew Snover)\n") |
85 | | - .withModuleOptions(moduleName, module.getClass()); |
| 97 | + Configurator opts = new Configurator().withModuleOptions(moduleName, module.getClass()); |
86 | 98 |
|
87 | 99 | // add "dynamic" options, which might be activated later |
88 | 100 | // by the specified switch values |
|
0 commit comments