You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@joshua.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2018/12/17 17:20:00 UTC

[jira] [Commented] (JOSHUA-329) A suspicious use of incrementer in for statement

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

Hudson commented on JOSHUA-329:
-------------------------------

SUCCESS: Integrated in Jenkins build joshua_master #202 (See [https://builds.apache.org/job/joshua_master/202/])
JOSHUA-329 - fixing wrong index selection (teofili: rev e9cb9ebb495782f4ed238e08e64f5503085641fc)
* (edit) src/main/java/org/apache/joshua/decoder/ff/lm/LanguageModelFF.java


> A suspicious use of incrementer in for statement
> ------------------------------------------------
>
>                 Key: JOSHUA-329
>                 URL: https://issues.apache.org/jira/browse/JOSHUA-329
>             Project: Joshua
>          Issue Type: Bug
>            Reporter: JC
>            Assignee: Tommaso Teofili
>            Priority: Trivial
>             Fix For: 7
>
>
> In a recent snapshot of the github mirror, I've found a suspicious incrementer in src/main/java/org/apache/joshua/decoder/ff/lm/LanguageModelFF.java.
> {code:java}
> 269       for (int i = 0; i < tokens.length; i++) {
> 270         if (tokens[i] > 0) { // skip nonterminals
> 271           for (int j = 0; j < alignments.length; j += 2) {
> 272             if (alignments[j] == i) {
> 273               String annotation = sentence.getAnnotation((int)alignments[i] + begin, "class");
> 274               if (annotation != null) {
> 275                 //                System.err.println(String.format("  word %d source %d abs %d annotation %d/%s"    ,
> 276                 //                    i, alignments[i], alignments[i] + begin, annotation, Vocabulary.word(annotation)));
> 277                 tokens[i] = Vocabulary.id(annotation);
> 278                 break;
> 279               }
> 280             }
> 281           }
> 282         }
> 283       }
> {code}
> In Line 273, alignments[i] should be alignments[j] if tokens.length is not same as alignments.length? Since I don't have domain knowledge, this may not be correct but just wanted to report this in case.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)