mawiesne commented on code in PR #742:
URL: https://github.com/apache/opennlp/pull/742#discussion_r1922505325


##########
opennlp-tools/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactory.java:
##########
@@ -30,55 +29,56 @@
 /**
  * @see BioNLP2004NameSampleStream
  */
-public class BioNLP2004NameSampleStreamFactory<P> extends 
AbstractSampleStreamFactory<NameSample, P> {
+public class BioNLP2004NameSampleStreamFactory extends
+        AbstractSampleStreamFactory<NameSample, 
BioNLP2004NameSampleStreamFactory.Parameters> {
 
-  interface Parameters extends BasicFormatParams {
+  public interface Parameters extends BasicFormatParams {
     @ParameterDescription(valueName = "DNA,protein,cell_type,cell_line,RNA")
     String getTypes();
   }
 
   public static void registerFactory() {
     StreamFactoryRegistry.registerFactory(NameSample.class,
-        "bionlp2004", new 
BioNLP2004NameSampleStreamFactory<>(Parameters.class));
+        "bionlp2004", new BioNLP2004NameSampleStreamFactory(Parameters.class));
   }
 
-  protected BioNLP2004NameSampleStreamFactory(Class<P> params) {
+  protected BioNLP2004NameSampleStreamFactory(Class<Parameters> params) {
     super(params);
   }
 
   @Override
   public ObjectStream<NameSample> create(String[] args) {
-
-    Parameters params = ArgumentParser.parse(args, Parameters.class);
+    Parameters params = validateBasicFormatParameters(args, Parameters.class);
 
     int typesToGenerate = 0;
-
-    if (params.getTypes().contains("DNA")) {
+    String types = params.getTypes();

Review Comment:
   Previous code was buggy. 
`BioNLP2004NameSampleStreamFactoryTest#testCreateWithValidParameter()` shows 
why: multiple types in the parameter list would not be processed correctly. Now 
they are "all" included in case present.



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