Skip to content

Commit 9df09ad

Browse files
Fix out of index error in candidate_generator
When the length is exactly equal to 1, there is indexing error while creating span (in tokenized_sentence[1])
1 parent 97b6045 commit 9df09ad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lmproof/candidate_generators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def _edits(
127127
elif replaced_token.is_upper:
128128
substitute = substitute.upper()
129129

130-
if token_idx == 0 and substitute == "" and len(tokenized_sentence) >= 1:
130+
if token_idx == 0 and substitute == "" and len(tokenized_sentence) > 1:
131131
candidate = Edit(
132132
Span(replaced_token.idx, tokenized_sentence[1].idx + 1),
133133
tokenized_sentence[1].text[0].upper(),

0 commit comments

Comments
 (0)