[ 
https://issues.apache.org/jira/browse/JOSHUA-329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tommaso Teofili resolved JOSHUA-329.
------------------------------------
       Resolution: Fixed
         Assignee: Tommaso Teofili
    Fix Version/s: 7

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

Reply via email to