cdqa-suite / cdQA

⛔ [NOT MAINTAINED] An End-To-End Closed Domain Question Answering System.
https://cdqa-suite.github.io/cdQA-website/
Apache License 2.0
615 stars 191 forks source link

read_squad_examples() does not work with our custom input object #61

Closed fmikaelian closed 5 years ago

fmikaelian commented 5 years ago

https://github.com/fmikaelian/cdQA/blob/6e26415fe604b70bfb9ba062b555680567a8ea58/cdqa/reader/bertqa_sklearn.py#L125

fmikaelian commented 5 years ago

Both object are <class 'list'>

I am now exploring the structure of those lists

fmikaelian commented 5 years ago

It seems it is due to the fact that question and id should be within paragraph'sqas:

{'title': 'Artificial Intelligence: more revolutionary than the Internet!',
 'paragraphs': [{'context': 'BNP Paribas launches the prototype AGORA, first online community for corporate clients',
   'qas': [],
   'question': 'Who is the creator of Artificial Intelligence?',
   'id': '6c383c98-3f2f-11e9-8649-0242ac110012'},
  {'context': 'Artificial Intelligence has progressed at lightning speed in recent years. Machines are now able to beat humans in Go matches, understand natural language, reason and learn. As a result, software and robots have something to offer in every field to make business more productive, profitable and innovative. Chronicle of a revolution foretold.',
   'qas': [],
   'question': 'Who is the creator of Artificial Intelligence?',
   'id': '6c383ea0-3f2f-11e9-8649-0242ac110012'},
  {'context': 'Artificial Intelligence refers to a set of technologies – machine learning, deep learning, language processing, etc. – that share one common feature in that they rely on a computer system capable of analyzing, understanding, learning and discovering connections between things, facts and events as well as manipulating concepts. It should come as no surprise that machines have acquired these extraordinary abilities. Just like flying cars, autonomous and hyper-intelligent humanoid robots have been a major part of science fiction for decades.',
   'qas': [],
   'question': 'Who is the creator of Artificial Intelligence?',
   'id': '6c383f68-3f2f-11e9-8649-0242ac110012'},
  {'context': '“Artificial Intelligence is a word that has been around for 60 years, but which ultimately refers to nothing more than software. Machines are very good at performing repetitive tasks and can help humans work more efficiently. But they cannot take their own initiatives and can only make progress by interacting with people”, explains Edouard d’Archimbaud, manager of the Data Science & Artificial Intelligence Lab at BNP Paribas CIB. ',
   'qas': [],
   'question': 'Who is the creator of Artificial Intelligence?',
   'id': '6c383ffe-3f2f-11e9-8649-0242ac110012'},

Compared to:

{'title': 'Super_Bowl_50',
 'paragraphs': [{'context': 'Super Bowl 50 was an American football game to determine the champion of the National Football League (NFL) for the 2015 season. The American Football Conference (AFC) champion Denver Broncos defeated the National Football Conference (NFC) champion Carolina Panthers 24–10 to earn their third Super Bowl title. The game was played on February 7, 2016, at Levi\'s Stadium in the San Francisco Bay Area at Santa Clara, California. As this was the 50th Super Bowl, the league emphasized the "golden anniversary" with various gold-themed initiatives, as well as temporarily suspending the tradition of naming each Super Bowl game with Roman numerals (under which the game would have been known as "Super Bowl L"), so that the logo could prominently feature the Arabic numerals 50.',
   'qas': [{'answers': [{'answer_start': 177, 'text': 'Denver Broncos'},
      {'answer_start': 177, 'text': 'Denver Broncos'},
      {'answer_start': 177, 'text': 'Denver Broncos'}],
     'question': 'Which NFL team represented the AFC at Super Bowl 50?',
     'id': '56be4db0acb8001400a502ec'},
    {'answers': [{'answer_start': 249, 'text': 'Carolina Panthers'},
      {'answer_start': 249, 'text': 'Carolina Panthers'},
      {'answer_start': 249, 'text': 'Carolina Panthers'}],
     'question': 'Which NFL team represented the NFC at Super Bowl 50?',
     'id': '56be4db0acb8001400a502ed'},
    ]},
  {'context': 'The Panthers finished the regular season with a 15–1 record, and quarterback Cam Newton was named the NFL Most Valuable Player (MVP). They defeated the Arizona Cardinals 49–15 in the NFC Championship Game and advanced to their second Super Bowl appearance since the franchise was founded in 1995. The Broncos finished the regular season with a 12–4 record, and denied the New England Patriots a chance to defend their title from Super Bowl XLIX by defeating them 20–18 in the AFC Championship Game. They joined the Patriots, Dallas Cowboys, and Pittsburgh Steelers as one of four teams that have made eight appearances in the Super Bowl.',
   'qas': [{'answers': [{'answer_start': 77, 'text': 'Cam Newton'},
      {'answer_start': 77, 'text': 'Cam Newton'},
      {'answer_start': 77, 'text': 'Cam Newton'}],
     'question': 'Which Carolina Panthers player was named Most Valuable Player?',
     'id': '56be4e1facb8001400a502f6'},
     ...