@@ -15,37 +15,27 @@ public class ConfusionMatrixTSV {
1515 /** A logger for this class */
1616 private static Redwood .RedwoodChannels log = Redwood .channels (ConfusionMatrixTSV .class );
1717
18- public static void main (String [] args ) {
18+ public static void main (String [] args ) throws IOException {
1919 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 ());
2121 System .exit (-1 );
2222 }
2323
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" ));
4128
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 ]);
4937 }
38+
39+ System .out .println (cm .toString ());
5040 }
51- }
41+ }
0 commit comments