You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@opennlp.apache.org by "rzo1 (via GitHub)" <gi...@apache.org> on 2023/03/06 20:10:47 UTC

[GitHub] [opennlp] rzo1 opened a new pull request, #520: OPENNLP-1450 - Revise log messages in OpenNLP regarding use of variable substitution

rzo1 opened a new pull request, #520:
URL: https://github.com/apache/opennlp/pull/520

   Thank you for contributing to Apache OpenNLP.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [x] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [x] Does your PR title start with OPENNLP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [x] Has your PR been rebased against the latest commit within the target branch (typically main)?
   
   - [x] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [x] Have you ensured that the full suite of tests is executed via mvn clean install at the root opennlp folder?
   - [ ] Have you written or updated unit tests to verify your changes?
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
   - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file in opennlp folder?
   - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found in opennlp folder?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   
   Next SLF4j part -> Variable substituion instead of string concat. Last one for now ;-)
   


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


[GitHub] [opennlp] rzo1 commented on pull request #520: OPENNLP-1450 - Revise log messages in OpenNLP regarding use of variable substitution

Posted by "rzo1 (via GitHub)" <gi...@apache.org>.
rzo1 commented on PR #520:
URL: https://github.com/apache/opennlp/pull/520#issuecomment-1458695896

   @mawiesne  Thanks for the review and the  {}()} eyes. Should be fixed now!


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


[GitHub] [opennlp] mawiesne commented on a diff in pull request #520: OPENNLP-1450 - Revise log messages in OpenNLP regarding use of variable substitution

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne commented on code in PR #520:
URL: https://github.com/apache/opennlp/pull/520#discussion_r1127805957


##########
opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/QNMinimizer.java:
##########
@@ -226,8 +226,8 @@ public double[] minimize(Function function) {
     if (logger.isDebugEnabled()) {
       logger.debug("Solving convex optimization problem.");
       logger.debug("Objective function has {} variable(s).", dimension);
-      logger.debug("Performing " + iterations + " iterations with " +
-          "L1Cost=" + l1Cost + " and L2Cost=" + l2Cost );
+      logger.debug("Performing {} iterations with L1Cost{}} and L2Cost={}",

Review Comment:
   Instead of `L1Cost{}}` this should read `L1Cost={}`, so remove one `}` and add `=`



##########
opennlp-tools/src/main/java/opennlp/tools/parser/treeinsert/Parser.java:
##########
@@ -305,9 +305,9 @@ else if (numNodes == 1) {  //put sentence initial and final punct in top node
     buildModel.eval(buildContextGenerator.getContext(children, advanceNodeIndex), bprobs);
     double doneProb = bprobs[doneIndex];
     if (logger.isDebugEnabled())
-      logger.debug("adi=" + advanceNodeIndex + " " + advanceNode.getType() + "."
-          + advanceNode.getLabel() + " " + advanceNode + " choose build=" + (1 - doneProb)
-          + " attach=" + doneProb);
+      logger.debug("adi={} {}.{} {} choose build={} attach={}",
+          advanceNode, advanceNode.getType(), advanceNode.getLabel(),

Review Comment:
   Cave: first parameter should be `advanceNodeIndex` instead of `advanceNode` (!)



##########
opennlp-tools/src/main/java/opennlp/tools/parser/treeinsert/Parser.java:
##########
@@ -465,21 +465,21 @@ else if (1 - cprobs[completeIndex] > probMass) { //just incomplete advances
                   setIncomplete(updatedNode);
                   newParse2.addProb(StrictMath.log(1 - cprobs[completeIndex]));
                   if (logger.isDebugEnabled())
-                    logger.debug("Advancing both complete and incomplete nodes; c="
-                            + cprobs[completeIndex]);
+                    logger.debug("Advancing both complete and incomplete nodes; c={}",
+                            cprobs[completeIndex]);
                 }
               }
             } else {
               if (logger.isDebugEnabled())
-                logger.debug("Skipping " + fn.getType() + "." + fn.getLabel() + " "
-                        + fn + " daughter=" + (attachment == daughterAttachIndex)
-                        + " complete=" + isComplete(fn) + " prob=" + prob);
+                logger.debug("Skipping {}.{} {} daughter={} complete={} prob={}",
+                     fn.getType(), fn.getLabel(), fn, (attachment == daughterAttachIndex),
+                        isComplete(fn), prob);
             }
           }
           if (checkComplete && !isComplete(fn)) {
             if (logger.isDebugEnabled())
-              logger.debug("Stopping at incomplete node(" + fi + "): "
-                  + fn.getType() + "." + fn.getLabel() + " " + fn);
+              logger.debug("Stopping at incomplete node({}}): {} . {} {}",

Review Comment:
   `node({}}):` should read `node({}):`



##########
opennlp-tools/src/main/java/opennlp/tools/ml/perceptron/SimplePerceptronSequenceTrainer.java:
##########
@@ -399,16 +398,16 @@ public void nextIteration(int iteration) throws IOException {
             predParams[oi] /= totIterations;
             averageParams[pi].setParameter(oi, predParams[oi]);
             if (logger.isTraceEnabled()) {
-              logger.trace("updates[" + pi + "][" + oi + "]=(" + updates[pi][oi][ITER] + ","
-                  + updates[pi][oi][EVENT] + "," + updates[pi][oi][VALUE] + ") + (" + iterations
-                  + "," + 0 + "," + params[pi].getParameters()[oi] + ") -> "
-                  + averageParams[pi].getParameters()[oi]);
+              logger.trace("updates[{}][{}]=({},{},{})({},{},{}= -> {}", pi, oi, updates[pi][oi][ITER],

Review Comment:
   `({},{},{})({},{},{}=` should read `({},{},{})({},{},{})`, note the `)` at the end.



##########
opennlp-tools/src/main/java/opennlp/tools/ml/perceptron/SimplePerceptronSequenceTrainer.java:
##########
@@ -399,16 +398,16 @@ public void nextIteration(int iteration) throws IOException {
             predParams[oi] /= totIterations;
             averageParams[pi].setParameter(oi, predParams[oi]);
             if (logger.isTraceEnabled()) {
-              logger.trace("updates[" + pi + "][" + oi + "]=(" + updates[pi][oi][ITER] + ","
-                  + updates[pi][oi][EVENT] + "," + updates[pi][oi][VALUE] + ") + (" + iterations
-                  + "," + 0 + "," + params[pi].getParameters()[oi] + ") -> "
-                  + averageParams[pi].getParameters()[oi]);
+              logger.trace("updates[{}][{}]=({},{},{})({},{},{}= -> {}", pi, oi, updates[pi][oi][ITER],
+                  updates[pi][oi][EVENT], updates[pi][oi][VALUE], iterations, 0,
+                  params[pi].getParameters()[oi], averageParams[pi].getParameters()[oi]);
             }
           }
         }
       }
     }
-    logger.info("{}. (" + numCorrect + "/" + numEvents + ") " + ((double) numCorrect / numEvents), iteration);
+    logger.info("{}. ({}/{}) {}", iteration, numCorrect,
+        numCorrect, ((double) numCorrect / numEvents));

Review Comment:
   the 3rd parameter should not be `numCorrect` but `numEvents` (!)



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


[GitHub] [opennlp] mawiesne merged pull request #520: OPENNLP-1450 - Revise log messages in OpenNLP regarding use of variable substitution

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne merged PR #520:
URL: https://github.com/apache/opennlp/pull/520


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