def determine_intersection(token, entity):
    """Calculates how many characters a given token and entity share."""
    pos_token = set(range(token.offset, token.end))
    pos_entity = set(range(entity['start'], entity['end']))
    return len(pos_token.intersection(pos_entity))
