(context, context_token, answer_start, answer_end)
return (None, None)
Get exact indices of the answer in the tokens of the passage,
    according to the start and end position of the answer.

    Args:
        context (str): the context passage
        context_token (list): list of tokens (str) in the context passage
        answer_start (int): the start position of the answer in the passage
        answer_end (int): the end position of the answer in the passage

    Returns:
        (int, int): start index and end index of answer
Get exact indices of the answer in the tokens of the passage,
    according to the start and end position of the answer.
Get exact indices of the answer in the tokens of the passage according to the start and end position of the answer .
def get_answer_index(context, context_token, answer_start, answer_end):
    '''
    Get exact indices of the answer in the tokens of the passage,
    according to the start and end position of the answer.

    Args:
        context (str): the context passage
        context_token (list): list of tokens (str) in the context passage
        answer_start (int): the start position of the answer in the passage
        answer_end (int): the end position of the answer in the passage

    Returns:
        (int, int): start index and end index of answer
    '''
    p_str = 0
    p_token = 0
    while p_str < len(context):
        if re.match('\s', context[p_str]):
            p_str += 1
            continue
        token = context_token[p_token]
        token_len = len(token)
        if context[p_str:p_str + token_len] != token:
            return (None, None)
        if p_str == answer_start:
            t_start = p_token
        p_str += token_len
        if p_str == answer_end:
            try:
                return (t_start, p_token)
            except UnboundLocalError as e:
                return (None, None)
        p_token += 1
    return (None, None)
def get_answer_index ( context , context_token , answer_start , answer_end ) : p_str = 0 p_token = 0 while p_str < len ( context ) : if re . match ( '\s' , context [ p_str ] ) : p_str += 1 continue token = context_token [ p_token ] token_len = len ( token ) if context [ p_str : p_str + token_len ] != token : return ( None , None ) if p_str == answer_start : t_start = p_token p_str += token_len if p_str == answer_end : try : return ( t_start , p_token ) except UnboundLocalError as e : return ( None , None ) p_token += 1 return ( None , None )