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 2022/12/29 18:59:47 UTC

[GitHub] [opennlp] kinow commented on a diff in pull request #472: OPENNLP-1414 Investigate why DownloadUtil can't retrieve NL models via a CDN

kinow commented on code in PR #472:
URL: https://github.com/apache/opennlp/pull/472#discussion_r1059107085


##########
opennlp-tools/src/test/java/opennlp/tools/util/DownloadUtilTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package opennlp.tools.util;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.stream.Stream;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.junit.jupiter.params.provider.NullAndEmptySource;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import opennlp.tools.sentdetect.SentenceModel;
+import opennlp.tools.tokenize.TokenizerModel;
+
+public class DownloadUtilTest {
+
+  @ParameterizedTest(name = "Verify \"{0}\" sentence model")
+  @ValueSource(strings = {"en", "fr", "de", "it", "nl"})
+  public void testDownloadModelByLanguage(String lang) throws IOException {
+    SentenceModel model = DownloadUtil.downloadModel(lang,
+            DownloadUtil.ModelType.SENTENCE_DETECTOR, SentenceModel.class);

Review Comment:
   Is the test here actually downloading the model? If so, do you think we could mock it to run offline?



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