SirYwell 4 лет назад
Родитель
Сommit
0818aa8a73

+ 8 - 7
jplag.frontend.text/src/main/java/de/jplag/text/ParserAdapter.java

@@ -1,12 +1,5 @@
 package de.jplag.text;
 
-import de.jplag.AbstractParser;
-import de.jplag.TokenConstants;
-import de.jplag.TokenList;
-import edu.stanford.nlp.ling.CoreLabel;
-import edu.stanford.nlp.pipeline.CoreDocument;
-import edu.stanford.nlp.pipeline.StanfordCoreNLP;
-
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
@@ -15,6 +8,14 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
+import de.jplag.AbstractParser;
+import de.jplag.TokenConstants;
+import de.jplag.TokenList;
+
+import edu.stanford.nlp.ling.CoreLabel;
+import edu.stanford.nlp.pipeline.CoreDocument;
+import edu.stanford.nlp.pipeline.StanfordCoreNLP;
+
 public class ParserAdapter extends AbstractParser {
 
     private final Map<String, Integer> tokenTypes = new HashMap<>();

+ 4 - 13
jplag.frontend.text/src/test/java/jplag/text/TextFrontendTest.java

@@ -12,7 +12,6 @@ import java.util.Map;
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.CleanupMode;
 import org.junit.jupiter.api.io.TempDir;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
@@ -56,28 +55,20 @@ class TextFrontendTest {
     }
 
     @ParameterizedTest
-    @ValueSource(strings = {
-        "\n",
-        "\r",
-        "\r\n",
-    })
+    @ValueSource(strings = {"\n", "\r", "\r\n",})
     void testLineBreakInputs(String input, @TempDir Path tempDir) throws IOException {
         Path file = tempDir.resolve("input.txt");
         Files.writeString(file, input);
-        TokenList result = frontend.parse(tempDir.toFile(), new String[]{"input.txt"});
+        TokenList result = frontend.parse(tempDir.toFile(), new String[] {"input.txt"});
         assertEquals(1, result.size());
     }
 
     @ParameterizedTest
-    @ValueSource(strings = {
-        "\ntoken",
-        "\rtoken",
-        "\r\ntoken",
-    })
+    @ValueSource(strings = {"\ntoken", "\rtoken", "\r\ntoken",})
     void testTokenAfterLineBreak(String input, @TempDir Path tempDir) throws IOException {
         Path file = tempDir.resolve("input.txt");
         Files.writeString(file, input);
-        TokenList result = frontend.parse(tempDir.toFile(), new String[]{"input.txt"});
+        TokenList result = frontend.parse(tempDir.toFile(), new String[] {"input.txt"});
         assertEquals(2, result.getToken(0).getLine());
     }