kinow commented on code in PR #58:
URL: https://github.com/apache/opennlp-sandbox/pull/58#discussion_r1081436022


##########
opennlp-coref/src/main/java/opennlp/tools/cmdline/coref/CoreferencerTool.java:
##########
@@ -85,8 +85,7 @@ private void show(Parse p) {
         System.out.print(" ");
       }
       Parse[] children = p.getChildren();
-      for (int pi = 0, pn = children.length; pi < pn;pi++) {
-        Parse c = children[pi];
+      for (Parse c : children) {

Review Comment:
   :ok_man: 



##########
opennlp-coref/src/main/java/opennlp/tools/formats/CorefSampleStreamFactory.java:
##########
@@ -42,16 +44,19 @@ public static void registerFactory() {
     StreamFactoryRegistry.registerFactory(CorefSample.class,
         StreamFactoryRegistry.DEFAULT_FORMAT, new CorefSampleStreamFactory());
   }
-  
+
+  @Override
   public ObjectStream<CorefSample> create(String[] args) {
     Parameters params = ArgumentParser.parse(args, Parameters.class);
 
     CmdLineUtil.checkInputFile("Data", params.getData());
-    FileInputStream sampleDataIn = CmdLineUtil.openInFile(params.getData());
-
-    ObjectStream<String> lineStream = new ParagraphStream(new 
PlainTextByLineStream(sampleDataIn
-        .getChannel(), params.getEncoding()));
-
-    return new CorefSampleDataStream(lineStream);
+    try {
+      MarkableFileInputStreamFactory factory = new 
MarkableFileInputStreamFactory(params.getData());
+      ObjectStream<String> lineStream = new ParagraphStream(new 
PlainTextByLineStream(
+              factory, params.getEncoding()));
+      return new CorefSampleDataStream(lineStream);

Review Comment:
   Ditto what I said in the other PR, if it makes sense, these factory and 
stream could be in the `try-with-resources`, assuming they are closeables and 
it makes sense :+1: 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to