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 15:28:16 UTC

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

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


##########
opennlp-wsd/src/test/java/opennlp/tools/disambiguator/LeskEvaluatorTest.java:
##########
@@ -23,23 +23,24 @@
 
 import opennlp.tools.disambiguator.datareader.SensevalReader;
 
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class LeskEvaluatorTest {
 
   static SensevalReader seReader = new SensevalReader();
 
   @Test
-  public static void main(String[] args) {
+  @Ignore // TODO Investigate why test fails while parsing 'EnglishLS.train'

Review Comment:
   :+1: maybe create an issue for later if we are not planning to work on this soon.



##########
opennlp-wsd/src/main/java/opennlp/tools/cmdline/disambiguator/DisambiguatorTool.java:
##########
@@ -117,11 +120,12 @@ static ObjectStream<WSDSample> openSampleData(String sampleDataName,
       File sampleDataFile, Charset encoding) {
     CmdLineUtil.checkInputFile(sampleDataName + " Data", sampleDataFile);
 
-    FileInputStream sampleDataIn = CmdLineUtil.openInFile(sampleDataFile);
-
-    ObjectStream<String> lineStream = new PlainTextByLineStream(
-        sampleDataIn.getChannel(), encoding);
-
-    return new WSDSampleStream(lineStream);
+    try {
+      MarkableFileInputStreamFactory factory = new MarkableFileInputStreamFactory(sampleDataFile);
+      ObjectStream<String> lineStream = new ParagraphStream(new PlainTextByLineStream(factory, encoding));

Review Comment:
   Sorry, not on my laptop with an IDE to confirm, but if these two are Closeable's perhaps they could be moved to the `try-with-resources`, if that makes sense.



-- 
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