NishantShri4 commented on code in PR #792:
URL: https://github.com/apache/opennlp/pull/792#discussion_r2147457557


##########
opennlp-tools/src/test/java/opennlp/tools/sentdetect/SentenceDetectorMEGermanTest.java:
##########
@@ -45,19 +48,25 @@ public class SentenceDetectorMEGermanTest extends 
AbstractSentenceDetectorTest {
   
   private static SentenceModel sentdetectModel;
 
-  @BeforeAll
-  public static void prepareResources() throws IOException {
-    Dictionary abbreviationDict = loadAbbDictionary(Locale.GERMAN);
-    SentenceDetectorFactory factory = new SentenceDetectorFactory(
-            "deu", true, abbreviationDict, EOS_CHARS);
-    sentdetectModel = train(factory, Locale.GERMAN);
-    Assertions.assertNotNull(sentdetectModel);
-    Assertions.assertEquals("deu", sentdetectModel.getLanguage());
+  private void prepareResources(boolean useTokenEnd) {

Review Comment:
   We need a way to configure the SentenceDetectorFactory differently i.e. 
useTokenEnd=true for some tests and with 
   useTokenEnd=false for one other test. 
   
   Approach1 -  @BeforeAll is removed, and the method prepareResources() is 
made private and parameterized so that the respective test case can get the 
trained model based on its need.  
   
   Appraoch-2 : Exclusively configure the SentenceDetectorFactory for the new 
test (i.e. useTokenEnd=false scenario) in its own definition and leave the  
previous @BeforeAll method as is. 
   
   Pls. suggest any preference of approach-2 over approach1 ?



-- 
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-unsubscr...@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to