(article)
return rows
Flatten each article in dev data
Flatten each article in dev data
Flatten each article in dev data
def proc_dev(article):
    '''Flatten each article in dev data'''
    rows = []
    for paragraph in article['paragraphs']:
        context = paragraph['context']
        for qa in paragraph['qas']:
            id_, question, answers = qa['id'], qa['question'], qa['answers']
            answers = [a['text'] for a in answers]
            rows.append((id_, context, question, answers))
    return rows
def proc_dev ( article ) : rows = [ ] for paragraph in article [ 'paragraphs' ] : context = paragraph [ 'context' ] for qa in paragraph [ 'qas' ] : id_ , question , answers = qa [ 'id' ] , qa [ 'question' ] , qa [ 'answers' ] answers = [ a [ 'text' ] for a in answers ] rows . append ( ( id_ , context , question , answers ) ) return rows