[
https://issues.apache.org/jira/browse/JOSHUA-329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15847740#comment-15847740
]
Matt Post commented on JOSHUA-329:
----------------------------------
I think you are correct. Thanks for pointing this out!
> 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: Jaechang Nam
> Priority: Trivial
>
> 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
(v6.3.15#6346)