Explore Library
Code QuizIntermediate

Named Entity Span Extraction

Extracting an entity substring from character offsets with the wrong slicing convention.

Codepython
text = "Alice lives in Paris"
# NER model reports entity 'Paris' with span (start=15, end=20)
# where 'end' is the exclusive index (Python slicing convention)
start, end = 15, 20
entity = text[start:end + 1]
print(entity)

What is the bug in this entity span extraction?