Unverified Commit 5960874b authored by Leo Gao's avatar Leo Gao Committed by GitHub
Browse files

Update qa4mre.py

parent a264f449
...@@ -64,9 +64,10 @@ class QA4MRE(MultipleChoiceTask): ...@@ -64,9 +64,10 @@ class QA4MRE(MultipleChoiceTask):
tree = ET.parse(textfilename) tree = ET.parse(textfilename)
root = tree.getroot() root = tree.getroot()
# TODO: context is much larger than the context sometimes # TODO: context is much larger than the context sometimes
# at the moment, it just gets left-truncated by LM automatically, and maybe that's good enough?
for reading_test in root.iter('reading-test'): for reading_test in root.iter('reading-test'):
src = reading_test[0].text src = reading_test[0].text
src = src.rstrip("\n\t\t\t").replace("\'", "'") src = src.strip().replace("\'", "'")
for qid, question in enumerate(reading_test.iter('q')): for qid, question in enumerate(reading_test.iter('q')):
out_doc = self._convert_standard(question) out_doc = self._convert_standard(question)
out_doc['source'] = src out_doc['source'] = src
...@@ -79,7 +80,7 @@ class QA4MRE(MultipleChoiceTask): ...@@ -79,7 +80,7 @@ class QA4MRE(MultipleChoiceTask):
return self.load_docs(f"data/qa4mre/QA4MRE-{self.YEAR}-EN_GS.xml") return self.load_docs(f"data/qa4mre/QA4MRE-{self.YEAR}-EN_GS.xml")
def doc_to_text(self, doc): def doc_to_text(self, doc):
return " {}\n{}".format(doc["source"], doc["query"]) return "{}\nQuestion: {}\nAnswer:".format(doc["source"], doc["query"])
class QA4MRE_2011(QA4MRE): class QA4MRE_2011(QA4MRE):
YEAR = 2011 YEAR = 2011
...@@ -88,4 +89,4 @@ class QA4MRE_2012(QA4MRE): ...@@ -88,4 +89,4 @@ class QA4MRE_2012(QA4MRE):
YEAR = 2012 YEAR = 2012
class QA4MRE_2013(QA4MRE): class QA4MRE_2013(QA4MRE):
YEAR = 2013 YEAR = 2013
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment