コード例 #1
0
 def create_examples(self, df):
     examples = []
     for _, line in df.iterrows():
         guid = line['#id']
         text_a = line['claim']
         text_b_0 = line['warrant0']
         text_b_1 = line['warrant1']
         label = int(line['correctLabelW0orW1'])
         examples.append([
             bert.InputExample(guid=guid,
                               text_a=text_a,
                               text_b=text_b_0,
                               label=label),
             bert.InputExample(guid=guid,
                               text_a=text_a,
                               text_b=text_b_1,
                               label=label)])
     return examples
コード例 #2
0
 def create_examples(self, df):
     examples = []
     for _, line in df.iterrows():
         guid = line['#id']
         text_a = self.append_claim_reason(line['claim'], line['reason'])
         text_b_0 = line['warrant0']
         text_b_1 = line['warrant1']
         # 0&1 both in fwd together - same label in both InputExamples OK
         label = int(line['correctLabelW0orW1'])
         examples.append([
             bert.InputExample(guid=guid,
                               text_a=text_a,
                               text_b=text_b_0,
                               label=label),
             bert.InputExample(guid=guid,
                               text_a=text_a,
                               text_b=text_b_1,
                               label=label)])
     return examples