You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@opennlp.apache.org by "kinow (via GitHub)" <gi...@apache.org> on 2023/04/20 20:21:59 UTC
[GitHub] [opennlp-sandbox] kinow commented on a diff in pull request #101: OPENNLP-1454 Convert System.out statements to debug logging statements in 'opennlp-similarity'
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?
--
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-unsubscribe@opennlp.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org