def _generate_examples(self, filepath):
    """This function returns the examples in the raw (text) form."""
    rows_per_pair_id = collections.defaultdict(list)

    with tf.io.gfile.GFile(filepath) as f:
      reader = csv.DictReader(f, delimiter='\t', quoting=csv.QUOTE_NONE)
      for row in reader:
        rows_per_pair_id[row['pairID']].append(row)

    for rows in six.itervalues(rows_per_pair_id):
      premise = {row['language']: row['sentence1'] for row in rows}
      hypothesis = {row['language']: row['sentence2'] for row in rows}
      yield {
          'premise': premise,
          'hypothesis': hypothesis,
          'label': rows[0]['gold_label'],
      }
def _generate_examples ( self , filepath ) : rows_per_pair_id = collections . defaultdict ( list ) with tf . io . gfile . GFile ( filepath ) as f : reader = csv . DictReader ( f , delimiter = '\t' , quoting = csv . QUOTE_NONE ) for row in reader : rows_per_pair_id [ row [ 'pairID' ] ] . append ( row ) for rows in six . itervalues ( rows_per_pair_id ) : premise = { row [ 'language' ] : row [ 'sentence1' ] for row in rows } hypothesis = { row [ 'language' ] : row [ 'sentence2' ] for row in rows } yield { 'premise' : premise , 'hypothesis' : hypothesis , 'label' : rows [ 0 ] [ 'gold_label' ] , }
This function returns the examples in the raw (text) form.