You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@opennlp.apache.org by GitBox <gi...@apache.org> on 2023/01/19 16:05:44 UTC

[GitHub] [opennlp-sandbox] mawiesne commented on a diff in pull request #58: Updates sandbox component 'opennlp-coref' to be compatible with latest opennlp-tools release

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


##########
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:
   Fixed.



-- 
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-unsubscribe@opennlp.apache.org

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