Commit a1f1dce0 authored by Lysandre's avatar Lysandre
Browse files

Correct max position for SQUAD and TFDS

parent 62c1fc3c
...@@ -571,7 +571,9 @@ class SquadExample(object): ...@@ -571,7 +571,9 @@ class SquadExample(object):
# Start end end positions only has a value during evaluation. # Start end end positions only has a value during evaluation.
if start_position_character is not None and not is_impossible: if start_position_character is not None and not is_impossible:
self.start_position = char_to_word_offset[start_position_character] self.start_position = char_to_word_offset[start_position_character]
self.end_position = char_to_word_offset[start_position_character + len(answer_text) - 1] self.end_position = char_to_word_offset[
min(start_position_character + len(answer_text) - 1, len(char_to_word_offset) - 1)
]
class SquadFeatures(object): class SquadFeatures(object):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment