def _create_examples(self, lines, set_type): """Creates examples for the training and dev sets.""" examples = [] for (i, line) in enumerate(lines): if i == 0: continue if set_type == 'test': guid = "%s-%s" % (set_type, i) text_a = line[-1] label = None examples.append( InputExample(guid=guid, text_a=text_a, text_b=None, label=label)) else: guid = "%s-%s" % (set_type, i) text_a = line[-1] label = line[1] examples.append( InputExample(guid=guid, text_a=text_a, text_b=None, label=label)) return examples
def _create_examples(self, lines, set_type): """Creates examples for the training and dev sets.""" examples = [] for (i, line) in enumerate(lines): if i == 0: continue guid = "%s-%s" % (set_type, line['pair-id']) text_a = line['context'] text_b = line['hypothesis'] if set_type == 'test': label = None else: label = line['label'] examples.append( InputExample(guid=guid, text_a=text_a, text_b=text_b, label=label)) return examples
def _create_examples(self, lines, set_type): """Creates examples for the training and dev sets.""" examples = [] for (i, line) in enumerate(lines): if i == 0: continue guid = str(line[7]) text_a = line[5] text_b = line[6] if set_type == 'test': label = None else: label = line[0] examples.append( InputExample(guid=guid, text_a=text_a, text_b=text_b, label=label)) return examples
def _create_examples(self, lines, set_type): """Creates examples for the training and dev sets.""" examples = [] for (i, line) in enumerate(lines): if i == 0: continue guid = "%s-%s" % (set_type, line[0]) text_a = line[8] text_b = line[9] if set_type == 'test': label = None else: label = line[-1] const_parsed_a = nltk.Tree.fromstring(line[6]) const_parsed_b = nltk.Tree.fromstring(line[7]) pos_tagged_a = re.findall(r'\([^\)\(]*\)', line[6]) pos_tagged_a = [ tuple([item.split()[1][:-1], item.split()[0][1:]]) for item in pos_tagged_a ] pos_tagged_b = re.findall(r'\([^\)\(]*\)', line[7]) pos_tagged_b = [ tuple([item.split()[1][:-1], item.split()[0][1:]]) for item in pos_tagged_b ] examples.append( InputExample(guid=guid, text_a=text_a, text_b=text_b, label=label, pos_tagged_a=pos_tagged_a, pos_tagged_b=pos_tagged_b, const_parsed_a=const_parsed_a, const_parsed_b=const_parsed_b)) return examples