orkg commited on
Commit
92ac58d
1 Parent(s): dcac0c5

Add answers to the dataset

Browse files
Files changed (1) hide show
  1. SciQA.py +37 -9
SciQA.py CHANGED
@@ -27,10 +27,33 @@ logger = datasets.logging.get_logger(__name__)
27
 
28
 
29
  _CITATION = """
30
- @article{SciQA,
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  title={The SciQA Scientific Question Answering Benchmark for Scholarly Knowledge},
32
- author={Auer, Sören and Barone, Dante A. C. and Bartz, Cassiano and Cortes, Eduardo G. and Jaradeh, Mohamad Yaser and Karras, Oliver and Koubarakis, Manolis and Mouromtsev, Dmitry and Pliukhin, Dmitrii and Radyush, Daniil and et al.},
33
- year={2023}
 
 
 
 
 
 
 
 
 
 
34
  """
35
 
36
  _DESCRIPTION = """\
@@ -47,7 +70,7 @@ class SciQA(datasets.GeneratorBasedBuilder):
47
  The SciQA Scientific Question Answering Benchmark for Scholarly Knowledge.
48
  """
49
 
50
- VERSION = datasets.Version("1.0.1")
51
 
52
  def _info(self):
53
  return datasets.DatasetInfo(
@@ -69,7 +92,8 @@ class SciQA(datasets.GeneratorBasedBuilder):
69
  "query_shape": datasets.Value("string"),
70
  "query_class": datasets.Value("string"),
71
  "auto_generated": datasets.Value("bool"),
72
- "number_of_patterns": datasets.Value("int32")
 
73
  }
74
  ),
75
  supervised_keys=None,
@@ -100,9 +124,12 @@ class SciQA(datasets.GeneratorBasedBuilder):
100
  def _generate_examples(self, filepath):
101
  """Yields examples."""
102
 
103
- with open(filepath, encoding="utf-8") as f:
104
- data = json.load(f)["questions"]
105
- for id_, row in enumerate(data):
 
 
 
106
  yield id_, {
107
  "id": row["id"],
108
  "query_type": row["query_type"],
@@ -113,5 +140,6 @@ class SciQA(datasets.GeneratorBasedBuilder):
113
  "query_shape": row["query_shape"],
114
  "query_class": row["query_class"],
115
  "auto_generated": row["auto_generated"],
116
- "number_of_patterns": row["number_of_patterns"]
 
117
  }
 
27
 
28
 
29
  _CITATION = """
30
+ @Article{SciQA2023,
31
+ author={Auer, S{\"o}ren
32
+ and Barone, Dante A. C.
33
+ and Bartz, Cassiano
34
+ and Cortes, Eduardo G.
35
+ and Jaradeh, Mohamad Yaser
36
+ and Karras, Oliver
37
+ and Koubarakis, Manolis
38
+ and Mouromtsev, Dmitry
39
+ and Pliukhin, Dmitrii
40
+ and Radyush, Daniil
41
+ and Shilin, Ivan
42
+ and Stocker, Markus
43
+ and Tsalapati, Eleni},
44
  title={The SciQA Scientific Question Answering Benchmark for Scholarly Knowledge},
45
+ journal={Scientific Reports},
46
+ year={2023},
47
+ month={May},
48
+ day={04},
49
+ volume={13},
50
+ number={1},
51
+ pages={7240},
52
+ abstract={Knowledge graphs have gained increasing popularity in the last decade in science and technology. However, knowledge graphs are currently relatively simple to moderate semantic structures that are mainly a collection of factual statements. Question answering (QA) benchmarks and systems were so far mainly geared towards encyclopedic knowledge graphs such as DBpedia and Wikidata. We present SciQA a scientific QA benchmark for scholarly knowledge. The benchmark leverages the Open Research Knowledge Graph (ORKG) which includes almost 170,000 resources describing research contributions of almost 15,000 scholarly articles from 709 research fields. Following a bottom-up methodology, we first manually developed a set of 100 complex questions that can be answered using this knowledge graph. Furthermore, we devised eight question templates with which we automatically generated further 2465 questions, that can also be answered with the ORKG. The questions cover a range of research fields and question types and are translated into corresponding SPARQL queries over the ORKG. Based on two preliminary evaluations, we show that the resulting SciQA benchmark represents a challenging task for next-generation QA systems. This task is part of the open competitions at the 22nd International Semantic Web Conference 2023 as the Scholarly Question Answering over Linked Data (QALD) Challenge.},
53
+ issn={2045-2322},
54
+ doi={10.1038/s41598-023-33607-z},
55
+ url={https://doi.org/10.1038/s41598-023-33607-z}
56
+ }
57
  """
58
 
59
  _DESCRIPTION = """\
 
70
  The SciQA Scientific Question Answering Benchmark for Scholarly Knowledge.
71
  """
72
 
73
+ VERSION = datasets.Version("1.0.2")
74
 
75
  def _info(self):
76
  return datasets.DatasetInfo(
 
92
  "query_shape": datasets.Value("string"),
93
  "query_class": datasets.Value("string"),
94
  "auto_generated": datasets.Value("bool"),
95
+ "number_of_patterns": datasets.Value("int32"),
96
+ "answers": datasets.dataset_dict.DatasetDict(),
97
  }
98
  ),
99
  supervised_keys=None,
 
124
  def _generate_examples(self, filepath):
125
  """Yields examples."""
126
 
127
+ question_filepath = filepath
128
+ answers_filepath = filepath.replace("questions.json", "answers.json")
129
+ with open(question_filepath, encoding="utf-8") as qf, open(answers_filepath, encoding="utf-8") as af:
130
+ questions_data = json.load(qf)["questions"]
131
+ answers_data = json.load(af)["answers"]
132
+ for id_, row in enumerate(questions_data):
133
  yield id_, {
134
  "id": row["id"],
135
  "query_type": row["query_type"],
 
140
  "query_shape": row["query_shape"],
141
  "query_class": row["query_class"],
142
  "auto_generated": row["auto_generated"],
143
+ "number_of_patterns": row["number_of_patterns"],
144
+ "answers": answers_data[id_]["answer"]
145
  }