@@ -15,37 +15,27 @@ public class ConfusionMatrixTSV {
15
15
/** A logger for this class */
16
16
private static Redwood .RedwoodChannels log = Redwood .channels (ConfusionMatrixTSV .class );
17
17
18
- public static void main (String [] args ) {
18
+ public static void main (String [] args ) throws IOException {
19
19
if (args .length < 1 ) {
20
- System .err .printf ("Usage: java %s answers_file%n" , ConfusionMatrix .class .getName ());
20
+ System .err .printf ("Usage: java %s answers_file%n" , ConfusionMatrixTSV .class .getName ());
21
21
System .exit (-1 );
22
22
}
23
23
24
- try {
25
- ConfusionMatrix <String > cm = new ConfusionMatrix <>();
26
-
27
- String answersFile = args [0 ];
28
- BufferedReader br = new BufferedReader (
29
- new InputStreamReader (new FileInputStream (answersFile ), "UTF-8" ));
30
-
31
- String line = br .readLine ();
32
- for (; line != null ; line = br .readLine ()) {
33
- String [] tokens = line .split ("\\ s" );
34
- if (tokens .length != 3 ) {
35
- System .err .printf ("ignoring bad line" );
36
- continue ;
37
- //System.exit(-1);
38
- }
39
- cm .add (tokens [2 ], tokens [1 ]);
40
- }
24
+ ConfusionMatrix <String > cm = new ConfusionMatrix <>();
25
+
26
+ String answersFile = args [0 ];
27
+ BufferedReader br = new BufferedReader (new InputStreamReader (new FileInputStream (answersFile ), "UTF-8" ));
41
28
42
- System .out .println (cm .toString ());
43
- } catch (UnsupportedEncodingException e ) {
44
- e .printStackTrace ();
45
- } catch (FileNotFoundException e ) {
46
- e .printStackTrace ();
47
- } catch (IOException e ) {
48
- e .printStackTrace ();
29
+ String line = br .readLine ();
30
+ for (; line != null ; line = br .readLine ()) {
31
+ String [] tokens = line .split ("\\ s" );
32
+ if (tokens .length != 3 ) {
33
+ System .err .printf ("ignoring bad line" );
34
+ continue ;
35
+ }
36
+ cm .add (tokens [2 ], tokens [1 ]);
49
37
}
38
+
39
+ System .out .println (cm .toString ());
50
40
}
51
- }
41
+ }
0 commit comments