Skip to content

Commit

Permalink
fix multitoken edit detector
Browse files Browse the repository at this point in the history
  • Loading branch information
breandan committed Oct 31, 2024
1 parent 0071449 commit 5f18bb6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ fun CFG.hasSingleEditRepair(tokens: List<String>, range: IntRange): Boolean =
val rangeSub = (maxOf(0, range.first) until minOf(tokens.size, range.last + 1))
val rangeIns = (maxOf(0, range.first) until minOf(tokens.size + 1, range.last + 2))
rangeSub.any { i -> toCheck.mapIndexed { j, t -> if (j == i) "_" else t } in language } // Check substitutions
&& rangeIns.any { (toCheck.take(it) + "_" + toCheck.drop(it)) in language } // Check insertions
|| rangeIns.any { (toCheck.take(it) + "_" + toCheck.drop(it)) in language } // Check insertions
}

// Tries to shrink a multi-edit range until it has a single edit repair
Expand Down

0 comments on commit 5f18bb6

Please sign in to comment.