def _create_example(row: OrderedDict):
    label = None
    (a_coref, b_coref) = map((lambda x: row.get(f'{x}-coref', '').upper()), 'AB')
    if ((a_coref == 'TRUE') and (b_coref == 'FALSE')):
        label = GAPLabel.A
    elif ((b_coref == 'TRUE') and (a_coref == 'FALSE')):
        label = GAPLabel.B
    elif ((a_coref == 'FALSE') and (b_coref == 'FALSE')):
        label = GAPLabel.NEITHER
    tokens = _word_tokenizer(row['Text'])
    pronoun_index = _char_to_token_offset(row['Text'], row['Pronoun'], int(row['Pronoun-offset']), tokens)
    assert (tokens[pronoun_index].lower() in PRONOUNS)
    a_start = _char_to_token_offset(row['Text'], row['A'], int(row['A-offset']), tokens)
    a_end = (a_start + len(_word_tokenizer(row['A'])))
    b_start = _char_to_token_offset(row['Text'], row['B'], int(row['B-offset']), tokens)
    b_end = (b_start + len(_word_tokenizer(row['B'])))
    example = GAPExample(id=row['ID'], url=row['URL'], tokens=tokens, pronoun_index=pronoun_index, a_start=a_start, a_end=a_end, b_start=b_start, b_end=b_end, label=label)
    return example
def _create_example(row: OrderedDict):
    label = None
    (a_coref, b_coref) = map((lambda x: row.get(f'{x}-coref', ).upper()), 'AB')
    if ((a_coref == 'TRUE') and (b_coref == 'FALSE')):
        label = GAPLabel.A
    elif ((b_coref == 'TRUE') and (a_coref == 'FALSE')):
        label = GAPLabel.B
    elif ((a_coref == 'FALSE') and (b_coref == 'FALSE')):
        label = GAPLabel.NEITHER
    tokens = _word_tokenizer(row['Text'])
    pronoun_index = _char_to_token_offset(row['Text'], row['Pronoun'], int(row['Pronoun-offset']), tokens)
    assert (tokens[pronoun_index].lower() in PRONOUNS)
    a_start = _char_to_token_offset(row['Text'], row['A'], int(row['A-offset']), tokens)
    a_end = (a_start + len(_word_tokenizer(row['A'])))
    b_start = _char_to_token_offset(row['Text'], row['B'], int(row['B-offset']), tokens)
    b_end = (b_start + len(_word_tokenizer(row['B'])))
    example = GAPExample(id=row['ID'], url=row['URL'], tokens=tokens, pronoun_index=pronoun_index, a_start=a_start, a_end=a_end, b_start=b_start, b_end=b_end, label=label)
    return example