[ 
https://issues.apache.org/jira/browse/OPENNLP-1454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17714738#comment-17714738
 ] 

ASF GitHub Bot commented on OPENNLP-1454:
-----------------------------------------

kinow commented on code in PR #101:
URL: https://github.com/apache/opennlp-sandbox/pull/101#discussion_r1173050608


##########
opennlp-similarity/src/main/java/opennlp/tools/similarity/apps/ContentGeneratorSupport.java:
##########
@@ -30,13 +29,14 @@
 import 
opennlp.tools.textsimilarity.chunker2matcher.ParserChunker2MatcherProcessor;
 
 import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This class supports content generation by static functions.
  */
 public class ContentGeneratorSupport {
-       private static final Logger LOG = Logger
-                       
.getLogger("opennlp.tools.similarity.apps.ContentGeneratorSupport");
+       private static final Logger logger = 
LoggerFactory.getLogger(ContentGeneratorSupport.class);

Review Comment:
   I find it weird to read `logger` and not `LOG` or `LOGGER` for a constant. 
Any reason for using lower case instead of upper case as it was before?



##########
opennlp-similarity/src/main/java/opennlp/tools/textsimilarity/ParseTreeChunkListScorer.java:
##########
@@ -78,15 +79,12 @@ public double getScore(ParseTreeChunk chunk) {
         }
       } else if (l.startsWith(LemmaGeneralizer.W2V_PREFIX) ){
          try {
-                       float val = 
Float.parseFloat(l.substring(LemmaGeneralizer.W2V_PREFIX.length()));
-                         score+= 1- val;
-               } catch (NumberFormatException e) {
-                       e.printStackTrace();
-               }
-      }
-      
-      else {
-
+          float val = 
Float.parseFloat(l.substring(LemmaGeneralizer.W2V_PREFIX.length()));
+            score+= 1- val;
+        } catch (NumberFormatException e) {
+          e.printStackTrace();

Review Comment:
   Maybe we should also control how stack traces are produced, using the logger 
instead of stdout?





> Convert System.out statements to debug logging statements in 
> 'opennlp-similarity' sandbox component
> ---------------------------------------------------------------------------------------------------
>
>                 Key: OPENNLP-1454
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-1454
>             Project: OpenNLP
>          Issue Type: Task
>          Components: Similarity
>    Affects Versions: 2.1.0
>            Reporter: Martin Wiesner
>            Assignee: Martin Wiesner
>            Priority: Minor
>
> In several classes of the 'opennlp-similarity' sandbox component, commented 
> System.out statements exist that have a debug statement flavor. Yet, in tests 
> and at runtime those spam the console quite heavily. That's why those have 
> been commented out during the compatibility migration towards tools version 
> 2.1.x conducted for all sandbox components.
> The aim of that issue is to convert those spammy log behavior by making use 
> of the slf4j-api. The code contains the spots marked with a TODO notice and 
> this issue number for which a switch to a logging framework with "trace" or 
> "debug" levels could be considered.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to