Fixed pending writes not flushed
@@ -6,6 +6,7 @@ import edu.stanford.nlp.process.PTBTokenizer;
import edu.stanford.nlp.process.WordToSentenceProcessor;
import eu.modernmt.io.*;
import org.apache.commons.cli.*;
+import org.apache.commons.io.IOUtils;
import java.io.StringReader;
import java.util.ArrayList;
@@ -64,6 +65,7 @@ public class StandfordSplitter {
LineWriter output = new UnixLineWriter(System.out, UTF8Charset.get());
ArrayList<String> strings = new ArrayList<>();
+ try {
String line;
while ((line = input.readLine()) != null) {
line = line.trim();
@@ -79,6 +81,10 @@ public class StandfordSplitter {
}
}
}
+ } finally {
+ IOUtils.closeQuietly(output);
+ IOUtils.closeQuietly(input);
+ }
}
}
\ No newline at end of file
