Commit
·
4627fea
1
Parent(s):
6deffc7
Create new file
Browse files- README.txt +33 -0
README.txt
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This is a version of squad derived from SQuAD v2 on which we did the following changes:
|
| 2 |
+
|
| 3 |
+
def remove_long_answers(example): #MAP
|
| 4 |
+
new_answers = {'text':[], 'answer_start':[]}
|
| 5 |
+
answers_set = set()
|
| 6 |
+
for text, start in zip(example['answers']['text'], example['answers']['answer_start']):
|
| 7 |
+
if len(text.split()) > 10:
|
| 8 |
+
continue
|
| 9 |
+
else:
|
| 10 |
+
if (text, start) not in answers_set:
|
| 11 |
+
new_answers['text'].append(text)
|
| 12 |
+
new_answers['answer_start'].append(start)
|
| 13 |
+
answers_set.add((text, start))
|
| 14 |
+
example['answers'] = new_answers
|
| 15 |
+
return example
|
| 16 |
+
|
| 17 |
+
def filter_whitespace(example): #MAP
|
| 18 |
+
example['context'] = ' '.join(example['context'].split())
|
| 19 |
+
example['question'] = ' '.join(example['question'].split())
|
| 20 |
+
example['answers']['text'] = [' '.join(answer.split()) for answer in example['answers']['text']]
|
| 21 |
+
return example
|
| 22 |
+
|
| 23 |
+
def checks(example): #FILTER
|
| 24 |
+
if example['answers']['text'] == []:
|
| 25 |
+
return False
|
| 26 |
+
|
| 27 |
+
if len(example['question'].split()) > 35:
|
| 28 |
+
return False
|
| 29 |
+
|
| 30 |
+
if len(example['question'].split()) < 3:
|
| 31 |
+
return False
|
| 32 |
+
|
| 33 |
+
return True
|