You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jz...@apache.org on 2022/04/22 11:41:32 UTC
[opennlp] branch master updated: OPENNLP-1318: Removing tests that were added to integration tests but not removed. (#414)
This is an automated email from the ASF dual-hosted git repository.
jzemerick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/opennlp.git
The following commit(s) were added to refs/heads/master by this push:
new 91e5affb OPENNLP-1318: Removing tests that were added to integration tests but not removed. (#414)
91e5affb is described below
commit 91e5affb4d91066bd99e3967faa1b9a5b8ecd626
Author: Jeff Zemerick <je...@mtnfog.com>
AuthorDate: Fri Apr 22 07:41:27 2022 -0400
OPENNLP-1318: Removing tests that were added to integration tests but not removed. (#414)
---
.../tools/sentdetect/SentenceDetectorMETest.java | 85 ----------------------
.../opennlp/tools/tokenize/TokenizerMETest.java | 14 +---
2 files changed, 1 insertion(+), 98 deletions(-)
diff --git a/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMETest.java b/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMETest.java
index 93ec184f..8cd8e68f 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMETest.java
+++ b/opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMETest.java
@@ -136,91 +136,6 @@ public class SentenceDetectorMETest {
}
- @Test
- public void testSentenceDetectorDownloadModel() throws IOException {
-
- SentenceDetectorME sentDetect = new SentenceDetectorME("en");
-
- // Tests sentence detector with sentDetect method
- String sampleSentences1 = "This is a test. There are many tests, this is the second.";
- String[] sents = sentDetect.sentDetect(sampleSentences1);
- Assert.assertEquals(sents.length,2);
- Assert.assertEquals(sents[0],"This is a test.");
- Assert.assertEquals(sents[1],"There are many tests, this is the second.");
- double[] probs = sentDetect.getSentenceProbabilities();
- Assert.assertEquals(probs.length,2);
-
- String sampleSentences2 = "This is a test. There are many tests, this is the second";
- sents = sentDetect.sentDetect(sampleSentences2);
- Assert.assertEquals(sents.length,2);
- probs = sentDetect.getSentenceProbabilities();
- Assert.assertEquals(probs.length,2);
- Assert.assertEquals(sents[0],"This is a test.");
- Assert.assertEquals(sents[1],"There are many tests, this is the second");
-
- String sampleSentences3 = "This is a \"test\". He said \"There are many tests, this is the second.\"";
- sents = sentDetect.sentDetect(sampleSentences3);
- Assert.assertEquals(sents.length,2);
- probs = sentDetect.getSentenceProbabilities();
- Assert.assertEquals(probs.length,2);
- Assert.assertEquals(sents[0],"This is a \"test\".");
- Assert.assertEquals(sents[1],"He said \"There are many tests, this is the second.\"");
-
- String sampleSentences4 = "This is a \"test\". I said \"This is a test.\" Any questions?";
- sents = sentDetect.sentDetect(sampleSentences4);
- Assert.assertEquals(sents.length,3);
- probs = sentDetect.getSentenceProbabilities();
- Assert.assertEquals(probs.length,3);
- Assert.assertEquals(sents[0],"This is a \"test\".");
- Assert.assertEquals(sents[1],"I said \"This is a test.\"");
- Assert.assertEquals(sents[2],"Any questions?");
-
- String sampleSentences5 = "This is a one sentence test space at the end. ";
- sents = sentDetect.sentDetect(sampleSentences5);
- Assert.assertEquals(1, sentDetect.getSentenceProbabilities().length);
- Assert.assertEquals(sents[0],"This is a one sentence test space at the end.");
-
- String sampleSentences6 = "This is a one sentences test with tab at the end. ";
- sents = sentDetect.sentDetect(sampleSentences6);
- Assert.assertEquals(sents[0],"This is a one sentences test with tab at the end.");
-
- String sampleSentences7 = "This is a test. With spaces between the two sentences.";
- sents = sentDetect.sentDetect(sampleSentences7);
- Assert.assertEquals(sents[0],"This is a test.");
- Assert.assertEquals(sents[1],"With spaces between the two sentences.");
-
- String sampleSentences9 = "";
- sents = sentDetect.sentDetect(sampleSentences9);
- Assert.assertEquals(0, sents.length);
-
- String sampleSentences10 = " "; // whitespaces and tabs
- sents = sentDetect.sentDetect(sampleSentences10);
- Assert.assertEquals(0, sents.length);
-
- String sampleSentences11 = "This is test sentence without a dot at the end and spaces ";
- sents = sentDetect.sentDetect(sampleSentences11);
- Assert.assertEquals(sents[0],"This is test sentence without a dot at the end and spaces");
- probs = sentDetect.getSentenceProbabilities();
- Assert.assertEquals(1, probs.length);
-
- String sampleSentence12 = " This is a test.";
- sents = sentDetect.sentDetect(sampleSentence12);
- Assert.assertEquals(sents[0],"This is a test.");
-
- String sampleSentence13 = " This is a test";
- sents = sentDetect.sentDetect(sampleSentence13);
- Assert.assertEquals(sents[0],"This is a test");
-
- // Test that sentPosDetect also works
- Span[] pos = sentDetect.sentPosDetect(sampleSentences2);
- Assert.assertEquals(pos.length,2);
- probs = sentDetect.getSentenceProbabilities();
- Assert.assertEquals(probs.length,2);
- Assert.assertEquals(new Span(0, 15), pos[0]);
- Assert.assertEquals(new Span(16, 56), pos[1]);
-
- }
-
@Test(expected = InsufficientTrainingDataException.class)
public void testInsufficientData() throws IOException {
diff --git a/opennlp-tools/src/test/java/opennlp/tools/tokenize/TokenizerMETest.java b/opennlp-tools/src/test/java/opennlp/tools/tokenize/TokenizerMETest.java
index 9535009b..aee25d6a 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/tokenize/TokenizerMETest.java
+++ b/opennlp-tools/src/test/java/opennlp/tools/tokenize/TokenizerMETest.java
@@ -54,19 +54,7 @@ public class TokenizerMETest {
Assert.assertEquals("test", tokens[0]);
Assert.assertEquals(",", tokens[1]);
}
-
- @Test
- public void testTokenizerDownloadedModel() throws IOException {
-
- TokenizerME tokenizer = new TokenizerME("en");
-
- String[] tokens = tokenizer.tokenize("test,");
-
- Assert.assertEquals(2, tokens.length);
- Assert.assertEquals("test", tokens[0]);
- Assert.assertEquals(",", tokens[1]);
- }
-
+
@Test
public void testTokenizer() throws IOException {
TokenizerModel model = TokenizerTestUtil.createMaxentTokenModel();