You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by kr...@apache.org on 2026/09/17 06:59:38 UTC
(opennlp) 10/10: Drop the superseded CoNLL-U tests from the regex branch merges
This is an automated email from the ASF dual-hosted git repository.
krickert pushed a commit to branch OPENNLP-1833-grpc-helper
in repository https://gitbox.apache.org/repos/asf/opennlp.git
commit b917ce68ccc8604b44125b1b773ba1d8cdf99568
Author: Kristian Rickert <kr...@apache.org>
AuthorDate: Thu Sep 17 02:58:28 2026 -0400
Drop the superseded CoNLL-U tests from the regex branch merges
---
.../tools/formats/conllu/ConlluStreamTest.java | 57 ----------------------
1 file changed, 57 deletions(-)
diff --git a/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluStreamTest.java
index 4bcb82d35..61ec19e67 100644
--- a/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluStreamTest.java
+++ b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluStreamTest.java
@@ -140,34 +140,6 @@ public class ConlluStreamTest extends AbstractConlluSampleStreamTest<SentenceSam
}
}
- @ParameterizedTest
- @CsvSource({"1-2, 1, 2", "1-3, 1, 3", "15-16, 15, 16", "7-7, 7, 7", "01-02, 1, 2"})
- void testParseContractionRange(String id, int start, int end) throws IOException {
- Assertions.assertArrayEquals(new int[] {start, end},
- ConlluStream.parseContractionRange(id));
- }
-
- @ParameterizedTest
- @ValueSource(strings = {"1-", "-2", "-", "1-2-3", "1--2", "a-b", "1-b", "a-2", "1 -2", "1- 2",
- "1.1-2", "\u0661-2", "3-1", "99999999999-2"})
- void testParseContractionRangeRejects(String id) {
- Assertions.assertThrows(InvalidFormatException.class,
- () -> ConlluStream.parseContractionRange(id));
- }
-
- @Test
- void testMalformedContractionIdFailsTheSentence() throws IOException {
- InputStreamFactory in = () -> new ByteArrayInputStream(
- ("1-\tdel\t_\t_\t_\t_\t_\t_\t_\t_\n"
- + "1\tde\tde\tADP\t_\t_\t2\tcase\t_\t_\n"
- + "2\tel\tel\tDET\t_\t_\t3\tdet\t_\t_\n")
- .getBytes(StandardCharsets.UTF_8));
-
- try (ObjectStream<ConlluSentence> stream = new ConlluStream(in)) {
- Assertions.assertThrows(InvalidFormatException.class, stream::read);
- }
- }
-
private static final String WORD_TAIL = "\t_\t_\t_\t0\troot\t_\t_\n";
private static String word(String id, String form) {
@@ -206,35 +178,6 @@ public class ConlluStreamTest extends AbstractConlluSampleStreamTest<SentenceSam
}
}
- @Test
- void testThreeLetterLangCodeIsPreferred() throws IOException {
- // "text_engl" gives "eng": three ASCII lowercase letters are preferred over two
- InputStreamFactory in = () -> new ByteArrayInputStream(
- ("# text_engl = Hello\n"
- + "1\tHello\thello\tINTJ\t_\t_\t0\troot\t_\t_\n")
- .getBytes(StandardCharsets.UTF_8));
-
- try (ObjectStream<ConlluSentence> stream = new ConlluStream(in)) {
- ConlluSentence sent = stream.read();
- Assertions.assertEquals(Optional.of(Collections.singletonMap(Locale.of("eng"), "Hello")),
- sent.getTextLang());
- Assertions.assertNull(stream.read(), "Stream must be exhausted");
- }
- }
-
- @Test
- void testInvalidTextLangCodeIsRejected() throws IOException {
- // "text_e" has a single lowercase letter, so no language code can be extracted
- InputStreamFactory in = () -> new ByteArrayInputStream(
- ("# text_e = Bonjour\n"
- + "1\tBonjour\tbonjour\tINTJ\t_\t_\t0\troot\t_\t_\n")
- .getBytes(StandardCharsets.UTF_8));
-
- try (ObjectStream<ConlluSentence> stream = new ConlluStream(in)) {
- Assertions.assertThrows(InvalidFormatException.class, stream::read);
- }
- }
-
@Test
void testRangeWithAllWordLinesIsMerged() throws IOException {
String sentence = range("1-2", "del") + word("1", "de") + word("2", "el") + word("3", "mar");